summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-17 09:24:13 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-17 09:24:13 +0000
commitf20d49cc68a0dd352605164a4f41f3b1acc2876b (patch)
tree20c05bbf05dc4da9f65d3bdf75012f3aa6f92df3 /src/CMakeLists.txt
parentd133f17dede836cee1dfff47d2e00532573b9ead (diff)
parent258ea460177a77c5d2cb45d623400cef2f7e0833 (diff)
Merge from trunk.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bitmap@1050 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 1a32dd3528c771a78d5749ac2c04503a3d979fe4
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt62
1 files changed, 42 insertions, 20 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2ef89f84..8c64b6a2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,29 +9,51 @@ 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)
-
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()
+
+ # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CMAKE_CXX_FLAGS are overwritten.
+ # cf. http://doc.cgal.org/latest/Manual/installation.html#title40
+ # A workaround is to include(${CGAL_USE_FILE}) before adding "-std=c++11".
+ # A fix would be to use https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
+ # or even better https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html
+ # but it implies to use cmake version 3.1 at least.
+ find_package(CGAL)
+ if(CGAL_FOUND)
+ include( ${CGAL_USE_FILE} )
+ endif()
+
+ 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")
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic -Wsign-compare")
+ endif()
+
+ 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()
+
+ 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