From 7a52c2fa71355631a559d74e0860fa6c5efa424e Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 26 Nov 2011 16:39:40 +0100 Subject: [PATCH] cmake: add option to disable building tests --- CMakeLists.txt | 11 ++++++----- simgear/environment/CMakeLists.txt | 4 +++- simgear/io/CMakeLists.txt | 3 ++- simgear/magvar/CMakeLists.txt | 4 ++-- simgear/math/CMakeLists.txt | 2 ++ simgear/misc/CMakeLists.txt | 3 ++- simgear/props/CMakeLists.txt | 2 ++ simgear/sound/CMakeLists.txt | 2 ++ 8 files changed, 21 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 825a5b02..07363346 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,7 @@ endif(NOT CMAKE_BUILD_TYPE) if(${CMAKE_VERSION} VERSION_GREATER 2.8.4) include(GNUInstallDirs) else(${CMAKE_VERSION} VERSION_GREATER 2.8.4) - include(OldGNUInstallDirs) + include(OldGNUInstallDirs) endif(${CMAKE_VERSION} VERSION_GREATER 2.8.4) message(STATUS "Library installation directory: ${CMAKE_INSTALL_LIBDIR}") @@ -62,6 +62,7 @@ option(SIMGEAR_HEADLESS "Set to ON to build SimGear without GUI/graphics support option(JPEG_FACTORY "Enable JPEG-factory support" OFF) option(ENABLE_LIBSVN "Set to ON to build SimGear with libsvnclient support" ON) option(ENABLE_RTI "Set to ON to build SimGear with RTI support" OFF) +option(ENABLE_TESTS "Set to OFF to disable building SimGear's test applications" ON) if (MSVC) GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH) @@ -236,12 +237,14 @@ configure_file ( "${PROJECT_SOURCE_DIR}/simgear/simgear_config_cmake.h.in" "${PROJECT_BINARY_DIR}/simgear/simgear_config.h" ) - + +if(ENABLE_TESTS) # enable CTest / make test target include (Dart) enable_testing() - +endif(ENABLE_TESTS) + install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/) add_subdirectory(simgear) @@ -255,5 +258,3 @@ CONFIGURE_FILE( ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") - - diff --git a/simgear/environment/CMakeLists.txt b/simgear/environment/CMakeLists.txt index c59f98a7..ae641d18 100644 --- a/simgear/environment/CMakeLists.txt +++ b/simgear/environment/CMakeLists.txt @@ -6,6 +6,7 @@ set(SOURCES metar.cxx precipitation.cxx) simgear_component(environment environment "${SOURCES}" "${HEADERS}") +if(ENABLE_TESTS) add_executable(test_metar test_metar.cxx) target_link_libraries(test_metar sgenvironment sgstructure sgmisc sgdebug @@ -13,4 +14,5 @@ target_link_libraries(test_metar ${ZLIB_LIBRARY} ${RT_LIBRARY}) -add_test(metar ${EXECUTABLE_OUTPUT_PATH}/test_metar) \ No newline at end of file +add_test(metar ${EXECUTABLE_OUTPUT_PATH}/test_metar) +endif(ENABLE_TESTS) diff --git a/simgear/io/CMakeLists.txt b/simgear/io/CMakeLists.txt index 84acd3f0..dd39d2ea 100644 --- a/simgear/io/CMakeLists.txt +++ b/simgear/io/CMakeLists.txt @@ -36,6 +36,7 @@ set(SOURCES simgear_component(io io "${SOURCES}" "${HEADERS}") +if(ENABLE_TESTS) add_executable(test_sock socktest.cxx) target_link_libraries(test_sock sgio sgstructure sgthreads sgdebug ${CMAKE_THREAD_LIBS_INIT} @@ -75,4 +76,4 @@ target_link_libraries(test_binobj ${RT_LIBRARY}) add_test(binobj ${EXECUTABLE_OUTPUT_PATH}/test_binobj) - \ No newline at end of file +endif(ENABLE_TESTS) diff --git a/simgear/magvar/CMakeLists.txt b/simgear/magvar/CMakeLists.txt index 0686ada1..08ce1e8a 100644 --- a/simgear/magvar/CMakeLists.txt +++ b/simgear/magvar/CMakeLists.txt @@ -6,7 +6,7 @@ set(SOURCES magvar.cxx coremag.cxx) simgear_component(magvar magvar "${SOURCES}" "${HEADERS}") - +if(ENABLE_TESTS) add_executable(test_magvar testmagvar.cxx ) target_link_libraries(test_magvar sgmagvar) - +endif(ENABLE_TESTS) diff --git a/simgear/math/CMakeLists.txt b/simgear/math/CMakeLists.txt index 55f2b151..49e1b785 100644 --- a/simgear/math/CMakeLists.txt +++ b/simgear/math/CMakeLists.txt @@ -45,6 +45,7 @@ set(SOURCES simgear_component(math math "${SOURCES}" "${HEADERS}") +if(ENABLE_TESTS) add_executable(math_test SGMathTest.cxx) target_link_libraries(math_test sgmath sgstructure sgdebug) add_test(math ${EXECUTABLE_OUTPUT_PATH}/math_test) @@ -52,3 +53,4 @@ add_test(math ${EXECUTABLE_OUTPUT_PATH}/math_test) add_executable(geometry_test SGGeometryTest.cxx) target_link_libraries(geometry_test sgmath sgstructure sgdebug) add_test(geometry ${EXECUTABLE_OUTPUT_PATH}/geometry_test) +endif(ENABLE_TESTS) diff --git a/simgear/misc/CMakeLists.txt b/simgear/misc/CMakeLists.txt index 43904321..597e80fa 100644 --- a/simgear/misc/CMakeLists.txt +++ b/simgear/misc/CMakeLists.txt @@ -32,6 +32,7 @@ set(SOURCES simgear_component(misc misc "${SOURCES}" "${HEADERS}") +if(ENABLE_TESTS) add_executable(test_tabbed_values tabbed_values_test.cxx) add_test(tabbed_values ${EXECUTABLE_OUTPUT_PATH}/test_tabbed_values) target_link_libraries(test_tabbed_values sgmisc) @@ -43,4 +44,4 @@ target_link_libraries(test_strings sgmisc) add_executable(test_path path_test.cxx ) add_test(test_path ${EXECUTABLE_OUTPUT_PATH}/test_path) target_link_libraries(test_path sgmisc sgdebug) - +endif(ENABLE_TESTS) diff --git a/simgear/props/CMakeLists.txt b/simgear/props/CMakeLists.txt index 46d81b35..dfd19160 100644 --- a/simgear/props/CMakeLists.txt +++ b/simgear/props/CMakeLists.txt @@ -22,6 +22,7 @@ set(SOURCES simgear_component(props props "${SOURCES}" "${HEADERS}") +if(ENABLE_TESTS) add_executable(test_props props_test.cxx) target_link_libraries(test_props sgprops sgxml sgstructure sgmisc sgdebug) add_test(test_props ${EXECUTABLE_OUTPUT_PATH}/test_props) @@ -29,3 +30,4 @@ add_test(test_props ${EXECUTABLE_OUTPUT_PATH}/test_props) add_executable(test_propertyObject propertyObject_test.cxx) target_link_libraries(test_propertyObject sgprops sgstructure sgdebug) add_test(test_propertyObject ${EXECUTABLE_OUTPUT_PATH}/test_propertyObject) +endif(ENABLE_TESTS) diff --git a/simgear/sound/CMakeLists.txt b/simgear/sound/CMakeLists.txt index 6670190a..69e1acd2 100644 --- a/simgear/sound/CMakeLists.txt +++ b/simgear/sound/CMakeLists.txt @@ -18,6 +18,7 @@ set(SOURCES simgear_component(sound sound "${SOURCES}" "${HEADERS}") +if(ENABLE_TESTS) set(SOUND_TEST_LIBS sgsound sgio sgmath sgstructure sgthreads sgtiming sgmisc sgdebug ${CMAKE_THREAD_LIBS_INIT} @@ -35,3 +36,4 @@ create_test(openal_test1) create_test(openal_test2) create_test(openal_test3) create_test(openal_test4) +endif(ENABLE_TESTS) -- 2.39.5