Sfoglia il codice sorgente

Refactoring CMAKE for MSVC support

submodule
Trevor Irons 6 anni fa
parent
commit
2b32ea46af
3 ha cambiato i file con 26 aggiunte e 21 eliminazioni
  1. 22
    21
      CMakeLists.txt
  2. 2
    0
      Modules/FDEM1D/CMakeLists.txt
  3. 2
    0
      Modules/LemmaCore/CMakeLists.txt

+ 22
- 21
CMakeLists.txt Vedi File

@@ -1,4 +1,4 @@
1
-cmake_minimum_required (VERSION 2.8.12)
1
+cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
2 2
 
3 3
 # Mac OSX RPATH is weird 
4 4
 # enable @rpath in the install name for any shared library being built
@@ -160,14 +160,14 @@ if ( LEMMA_VTK7_SUPPORT )
160 160
 	#include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
161 161
 endif()
162 162
 
163
-#####################
164
-# Lemma Configuration
165
-#####################
163
+#######################
164
+# Lemma Configuration #
165
+#######################
166 166
 
167
-#####################
168
-# Look for Ki Ha Lee 
169
-#####################
170
-FIND_LIBRARY( KIHA_EM1D kihaem1d ) # PATHS ${/home/tirons/local/lib}  )
167
+#############################
168
+# Look for Ki Ha Lee (EM1D) #
169
+#############################
170
+FIND_LIBRARY( KIHA_EM1D kihaem1d ) 
171 171
 if ( KIHA_EM1D )
172 172
 	add_compile_options(-DKIHALEE_EM1D)
173 173
 endif()
@@ -197,21 +197,22 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
197 197
 
198 198
 ####################
199 199
 # Add the c++11 flag 
200
+# This has been moved to TARGET PROPERTY as each library is built
200 201
 # TODO add compiler specific instructions
201
-include(CheckCXXCompilerFlag)
202
-CHECK_CXX_COMPILER_FLAG(-std=c++14 COMPILER_SUPPORTS_CXX14)
203
-CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
204
-CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
202
+#include(CheckCXXCompilerFlag)
203
+#CHECK_CXX_COMPILER_FLAG(-std=c++14 COMPILER_SUPPORTS_CXX14)
204
+#CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
205
+#CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
205 206
 # TODO update this for MSVC and cross compatibility 
206
-if(COMPILER_SUPPORTS_CXX14)
207
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
208
-elseif(COMPILER_SUPPORTS_CXX11)
209
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
210
-elseif(COMPILER_SUPPORTS_CXX0X)
211
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
212
-else()
213
-	message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or C++14 support. Please use a different C++ compiler.")
214
-endif()
207
+#if(COMPILER_SUPPORTS_CXX14)
208
+#	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
209
+#elseif(COMPILER_SUPPORTS_CXX11)
210
+#	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
211
+#elseif(COMPILER_SUPPORTS_CXX0X)
212
+#	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
213
+#else()
214
+#	message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or C++14 support. Please use a different C++ compiler.")
215
+#endif()
215 216
 
216 217
 option( LEMMA_BUILD_EXAMPLES "Compile example Lemma applications" OFF )
217 218
 

+ 2
- 0
Modules/FDEM1D/CMakeLists.txt Vedi File

@@ -6,6 +6,8 @@ set_target_properties(fdem1d PROPERTIES
6 6
 	VERSION  "${LEMMA_VERSION_NOQUOTES}"
7 7
 	SOVERSION "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}"
8 8
 	PROJECT_LABEL "FDEM1D ${LABEL_SUFFIX}"
9
+    CXX_STANDARD 14
10
+    CXX_STANDARD_REQUIRED ON
9 11
 )
10 12
 
11 13
 # Linking

+ 2
- 0
Modules/LemmaCore/CMakeLists.txt Vedi File

@@ -6,6 +6,8 @@ set_target_properties(lemmacore PROPERTIES
6 6
 	VERSION  "${LEMMA_VERSION_NOQUOTES}"
7 7
 	SOVERSION "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}"
8 8
 	PROJECT_LABEL "LemmaCore ${LABEL_SUFFIX}"
9
+    CXX_STANDARD 14
10
+    CXX_STANDARD_REQUIRED ON
9 11
 )
10 12
 
11 13
 # External project dependencies 

Loading…
Annulla
Salva