summaryrefslogtreecommitdiff
path: root/src/cmake
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-15 19:55:31 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-15 19:55:31 +0000
commit00a3424bd68ced3e2d159acf8b2e73f515a3d88b (patch)
tree6c42790a1498d7dcafa375770bb66effebe9b5f1 /src/cmake
parentd0563b1dcb0061b3ad39236ea82e35a3b4722ea4 (diff)
CMake minimal version is now 3.1
Compilation flags are now externalized in cmake/modules Add NO_POLICY_SCOPE for GUDHI_third_parties to fix warnings Try to fix CGAL 4.12 that is no more setting CGAL_LIBRARIES git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cmake_v3_vincent@3445 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 0ac7613f016e28cc634606f76e85ecaf5bacb2d4
Diffstat (limited to 'src/cmake')
-rw-r--r--src/cmake/modules/GUDHI_compilation_flags.cmake36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/cmake/modules/GUDHI_compilation_flags.cmake b/src/cmake/modules/GUDHI_compilation_flags.cmake
new file mode 100644
index 00000000..614d3812
--- /dev/null
+++ b/src/cmake/modules/GUDHI_compilation_flags.cmake
@@ -0,0 +1,36 @@
+# This files manage compilation flags required by GUDHI
+
+include(TestCXXAcceptsFlag)
+
+# add a compiler flag only if it is accepted
+macro(add_cxx_compiler_flag _flag)
+ string(REPLACE "-" "_" _flag_var ${_flag})
+ check_cxx_accepts_flag("${_flag}" CXX_COMPILER_${_flag_var}_OK)
+ if(CXX_COMPILER_${_flag_var}_OK)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
+ endif()
+endmacro()
+
+set (CMAKE_CXX_STANDARD 11)
+
+enable_testing()
+
+if(MSVC)
+ # Turn off some VC++ warnings
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018")
+endif()
+
+add_cxx_compiler_flag("-Wall")
+add_cxx_compiler_flag("-pedantic")
+
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+ message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
+else()
+ message("++ Release compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
+endif()
+
+if (DEBUG_TRACES)
+ # For programs to be more verbose
+ message(STATUS "DEBUG_TRACES are activated")
+ add_definitions(-DDEBUG_TRACES)
+endif()