Skip to content

Commit adc1d33

Browse files
committed
Adjust MSVC OpenMP configuration
1 parent d4b9dd0 commit adc1d33

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

cmake/openmp.cmake

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
if(MSVC)
2+
set(OpenMP_C_FLAGS "/openmp:llvm" CACHE STRING "OpenMP C flags" FORCE)
3+
set(OpenMP_CXX_FLAGS "/openmp:llvm" CACHE STRING "OpenMP CXX flags" FORCE)
4+
endif()
5+
16
find_package(OpenMP)
27
if(OpenMP_FOUND)
38
include_directories(${OpenMP_C_INCLUDE_DIRS} ${OpenMP_CXX_INCLUDE_DIRS})
4-
5-
if(MSVC)
6-
string(REPLACE "/openmp" "/openmp:llvm" OpenMP_C_FLAGS "${OpenMP_C_FLAGS}")
7-
string(REPLACE "/openmp" "/openmp:llvm" OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS}")
8-
endif()
9-
109
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
1110
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
1211
set(CMAKE_EXE_LINKER_FLAGS

modules/core/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ target_link_libraries(${exec_func_lib} PUBLIC gtest gtest_main)
4444
target_link_libraries(${exec_func_lib} PUBLIC Threads::Threads)
4545

4646
find_package(OpenMP REQUIRED)
47-
if(MSVC)
48-
string(REPLACE "/openmp" "/openmp:llvm" OpenMP_C_FLAGS "${OpenMP_C_FLAGS}")
49-
string(REPLACE "/openmp" "/openmp:llvm" OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS}")
50-
endif()
5147
target_link_libraries(${exec_func_lib} PUBLIC ${OpenMP_libomp_LIBRARY}
5248
OpenMP::OpenMP_CXX)
5349

0 commit comments

Comments
 (0)