summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-02-04 16:11:42 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-02-04 16:11:42 +0000
commitc85b24f7e0c489093e0c5ccca934eb53fafab623 (patch)
tree02300d8f78d1137209198447f7b5a45feb40a7d8 /src/CMakeLists.txt
parentb83c3869618d3697eb476bd6942076ff7aedafe4 (diff)
CMake strategy modification
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@1003 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c917934525e020b54b2f4506b5c9d060a28c9d89
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt67
1 files changed, 43 insertions, 24 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3c38483c..a67e7c92 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,33 +9,52 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
find_package(Boost REQUIRED COMPONENTS system filesystem program_options chrono timer REQUIRED)
-if (NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE "Release")
-endif()
-if(MSVC)
- SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018")
-else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-endif()
-
-set(Boost_USE_STATIC_LIBS ON)
-set(Boost_USE_MULTITHREADED ON)
-set(Boost_USE_STATIC_RUNTIME OFF)
-
-find_package(GMP)
-if(GMP_FOUND)
- find_package(GMPXX)
-endif()
-
-find_package(CGAL)
-
-# Find TBB package for parallel sort - not mandatory, just optional.
-set(TBB_FIND_QUIETLY ON)
-find_package(TBB)
-
if(NOT Boost_FOUND)
message(FATAL_ERROR "NOTICE: This demo requires Boost and will not be compiled.")
else()
+
+ find_package(GMP)
+ if(GMP_FOUND)
+ INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR})
+ find_package(GMPXX)
+ if(GMPXX_FOUND)
+ INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR})
+ endif()
+ endif()
+
+ # find CGAL package before set of CXX flags because
+ # in CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten.
+ # cf. http://doc.cgal.org/latest/Manual/installation.html#title40
+ set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "Force CGAL to maintain CMAKE flags")
+ find_package(CGAL)
+ if(CGAL_FOUND)
+ include( ${CGAL_USE_FILE} )
+ set(CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS "-frounding-math")
+ endif()
+
+ if (NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+ endif()
+ if(MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018")
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS}")
+ endif()
+
+ if(CMAKE_BUILD_TYPE MATCHES Debug)
+ message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
+ else()
+ message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
+ endif()
+
+ set(Boost_USE_STATIC_LIBS ON)
+ set(Boost_USE_MULTITHREADED ON)
+ set(Boost_USE_STATIC_RUNTIME OFF)
+
+ # Find TBB package for parallel sort - not mandatory, just optional.
+ set(TBB_FIND_QUIETLY ON)
+ find_package(TBB)
+
# BOOST ISSUE result_of vs C++11
add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
# BOOST ISSUE with Libraries name resolution under Windows