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,7 +202,7 @@ include(CheckCXXCompilerFlag)
202 202
 CHECK_CXX_COMPILER_FLAG(-std=c++14 COMPILER_SUPPORTS_CXX14)
203 203
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
204 204
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
205
-
205
+# TODO update this for MSVC and cross compatibility 
206 206
 if(COMPILER_SUPPORTS_CXX14)
207 207
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
208 208
 elseif(COMPILER_SUPPORTS_CXX11)
@@ -216,9 +216,11 @@ endif()
216 216
 option( LEMMA_BUILD_EXAMPLES "Compile example Lemma applications" OFF )
217 217
 
218 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 224
 endif()
223 225
 
224 226
 set(LEMMA_VERSION_MAJOR "0")

Loading…
Cancel
Save