2011-12-14 10:24:18 +08:00
project ( GTSAM CXX C )
2011-12-14 10:24:23 +08:00
cmake_minimum_required ( VERSION 2.6 )
# Set the version number for the libarary
2011-12-14 10:24:18 +08:00
set ( GTSAM_VERSION_MAJOR 0 )
set ( GTSAM_VERSION_MINOR 9 )
set ( GTSAM_VERSION_PATCH 3 )
# guard against in-source builds
if ( ${ CMAKE_SOURCE_DIR } STREQUAL ${ CMAKE_BINARY_DIR } )
message ( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. " )
endif ( )
# Turn off function inlining when debugging
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-inline -Wall" )
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -Wall" )
# No optimization in relwithdebinfo
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall" )
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall" )
# Eigen no debug in release mode
set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DEIGEN_NO_DEBUG" )
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DEIGEN_NO_DEBUG" )
# Configurable Options
2011-12-14 10:24:19 +08:00
# Pull in tests
2011-12-14 10:24:23 +08:00
enable_testing ( )
include ( Dart )
include ( CTest )
# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck)
add_custom_target ( check COMMAND ${ CMAKE_CTEST_COMMAND } )
2011-12-14 10:24:19 +08:00
2011-12-14 10:24:21 +08:00
# Find boost
find_package ( Boost 1.40 REQUIRED )
2011-12-14 10:24:18 +08:00
# General build settings
2011-12-14 10:24:21 +08:00
include_directories (
g t s a m / 3 r d p a r t y / U F c o n f i g
g t s a m / 3 r d p a r t y / C C O L A M D / I n c l u d e
$ { C M A K E _ S O U R C E _ D I R }
C p p U n i t L i t e
$ { B O O S T _ I N C L U D E _ D I R } )
link_directories ( ${ Boost_LIBRARY_DIRS } )
2011-12-14 10:24:18 +08:00
# Build GTSAM library
add_subdirectory ( gtsam )
# Build CppUnitLite
add_subdirectory ( CppUnitLite )
# Build Tests
2011-12-14 10:24:21 +08:00
add_subdirectory ( tests )
2011-12-14 10:24:18 +08:00
# Build wrap
2011-12-14 10:24:21 +08:00
add_subdirectory ( wrap )
2011-12-14 10:24:18 +08:00
# Build examples
2011-12-14 10:24:21 +08:00
add_subdirectory ( examples )