Browse Source

more roubust detection of OpenMP across compilers, inc. MSVC

submodule
Trevor Irons 7 years ago
parent
commit
56b8936be7
1 changed files with 6 additions and 4 deletions
  1. 6
    4
      CMakeLists.txt

+ 6
- 4
CMakeLists.txt View File

202
 CHECK_CXX_COMPILER_FLAG(-std=c++14 COMPILER_SUPPORTS_CXX14)
202
 CHECK_CXX_COMPILER_FLAG(-std=c++14 COMPILER_SUPPORTS_CXX14)
203
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
203
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
204
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
204
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
205
-
205
+# TODO update this for MSVC and cross compatibility 
206
 if(COMPILER_SUPPORTS_CXX14)
206
 if(COMPILER_SUPPORTS_CXX14)
207
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
207
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
208
 elseif(COMPILER_SUPPORTS_CXX11)
208
 elseif(COMPILER_SUPPORTS_CXX11)
216
 option( LEMMA_BUILD_EXAMPLES "Compile example Lemma applications" OFF )
216
 option( LEMMA_BUILD_EXAMPLES "Compile example Lemma applications" OFF )
217
 
217
 
218
 option( LEMMA_USE_OPENMP  "Use OpenMP in Lemma" OFF)
218
 option( LEMMA_USE_OPENMP  "Use OpenMP in Lemma" OFF)
219
-CHECK_CXX_COMPILER_FLAG(-fopenmp COMPILER_SUPPORTS_OPENMP)
220
-if(COMPILER_SUPPORTS_OPENMP AND LEMMA_USE_OPENMP )
221
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -DLEMMAUSEOMP")
219
+find_package(OpenMP)
220
+if (OPENMP_FOUND AND LEMMA_USE_OPENMP)
221
+    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
222
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
223
+    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
222
 endif()
224
 endif()
223
 
225
 
224
 set(LEMMA_VERSION_MAJOR "0")
226
 set(LEMMA_VERSION_MAJOR "0")

Loading…
Cancel
Save