在CMakelist.txt中配置OpenMP

这两天在做通信系统滤波器的设计,考虑到要在项目中加入OpenMp并行编程的代码,下面贴一下应该在CMakelist.txt中应该添加的代码

FIND_PACKAGE( OpenMP REQUIRED)
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()

你可能感兴趣的:(OpenMp,编译器,CMake,c,openmp,并行编程,通信)