From 218500de11b858da3f6bd5b9d937f07eee455b0c Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Thu, 13 Feb 2014 13:22:56 -0500 Subject: [PATCH] Cleaned up flags for building examples and tests --- CMakeLists.txt | 21 ++++----------------- cmake/GtsamTesting.cmake | 16 +++++++++------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22e58564b..da60d1432 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,6 @@ endif() # Configurable Options option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" OFF) # These do not currently work -option(GTSAM_BUILD_EXAMPLES "Enable/Disable building of examples" ON) if(GTSAM_UNSTABLE_AVAILABLE) option(GTSAM_BUILD_UNSTABLE "Enable/Disable libgtsam_unstable" ON) endif() @@ -82,17 +81,6 @@ endif() set(CPACK_SOURCE_GENERATOR "TGZ" CACHE STRING "CPack Default Source Generator") set(CPACK_GENERATOR "TGZ" CACHE STRING "CPack Default Binary Generator") -# Flags to determine whether examples are build during 'make install' -# Note that these remove the targets from the 'all' -option(GTSAM_DISABLE_EXAMPLES_ON_INSTALL "Disables building examples during install" OFF) - -# Pull in infrastructure -if (GTSAM_BUILD_TESTS) - enable_testing() - include(Dart) - include(CTest) -endif() - ############################################################################### # Find boost @@ -362,18 +350,17 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.43)") #Example: "libc6 (>= message(STATUS "===============================================================") message(STATUS "================ Configuration Options ======================") message(STATUS "Build flags ") -print_config_flag(${GTSAM_BUILD_TIMING} "Build Timing scripts ") -print_config_flag(${GTSAM_BUILD_EXAMPLES} "Build Examples ") print_config_flag(${GTSAM_BUILD_TESTS} "Build Tests ") +print_config_flag(${GTSAM_BUILD_EXAMPLES_ALWAYS} "Build examples with 'make all' ") +print_config_flag(${GTSAM_BUILD_TIMING} "Build Timing scripts ") if (DOXYGEN_FOUND) - print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ") + print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ") endif() print_config_flag(${GTSAM_BUILD_STATIC_LIBRARY} "Build static GTSAM library instead of shared") print_config_flag(${GTSAM_BUILD_TYPE_POSTFIXES} "Put build type in library name ") if(GTSAM_UNSTABLE_AVAILABLE) - print_config_flag(${GTSAM_BUILD_UNSTABLE} "Build libgtsam_unstable ") + print_config_flag(${GTSAM_BUILD_UNSTABLE} "Build libgtsam_unstable ") endif() -print_config_flag(${GTSAM_DISABLE_EXAMPLES_ON_INSTALL} "No examples in all or install ") string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper) if(NOT MSVC AND NOT XCODE_VERSION) message(STATUS " Build type : ${CMAKE_BUILD_TYPE}") diff --git a/cmake/GtsamTesting.cmake b/cmake/GtsamTesting.cmake index fbde55a28..6170fd154 100644 --- a/cmake/GtsamTesting.cmake +++ b/cmake/GtsamTesting.cmake @@ -3,13 +3,7 @@ enable_testing() option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON) - -# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck) -if(GTSAM_BUILD_TESTS) - add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $ --output-on-failure) -endif() - -add_custom_target(timing) +option(GTSAM_BUILD_EXAMPLES_ALWAYS "Build examples with 'make all' (build with 'make examples' if not)" ON) # Add option for combining unit tests if(MSVC OR XCODE_VERSION) @@ -19,6 +13,14 @@ else() endif() mark_as_advanced(GTSAM_SINGLE_TEST_EXE) +# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck) +if(GTSAM_BUILD_TESTS) + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $ --output-on-failure) +endif() + +add_custom_target(timing) +add_custom_target(examples) + # Macro for adding a group of tests relative to the current directory. # globPatterns: e.g. "test*.cpp", or a list of globs, e.g. "testA*.cpp;testB*.cpp". # excludedFiles: list of files or globs to exclude, e.g. "testC*.cpp;testBroken.cpp".