From e08eda18d5953e4859034a49906409c2df0cd743 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Fri, 15 Mar 2013 23:21:38 +0100 Subject: [PATCH] CMake: Create list of libs for testing only once --- CMakeLists.txt | 20 +++++++++++++++++++- Doxyfile | 4 ++-- simgear/io/CMakeLists.txt | 11 +---------- simgear/math/CMakeLists.txt | 7 +------ simgear/misc/CMakeLists.txt | 9 +-------- simgear/nasal/cppbind/CMakeLists.txt | 7 ------- simgear/props/CMakeLists.txt | 6 ------ simgear/props/props_test.cxx | 10 +++++----- simgear/scene/tgdb/CMakeLists.txt | 5 ----- simgear/scene/util/CMakeLists.txt | 4 +++- simgear/sound/CMakeLists.txt | 10 ++++------ simgear/structure/CMakeLists.txt | 11 +---------- 12 files changed, 37 insertions(+), 67 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7fd4d55..b592c5cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,7 +360,25 @@ if(ENABLE_TESTS) message(STATUS "Tests: ENABLED") include (Dart) - enable_testing() + enable_testing() + + if(SIMGEAR_SHARED) + set( TEST_LIBS + SimGearCore) + else() + set( TEST_LIBS + SimGearCore + ${CMAKE_THREAD_LIBS_INIT} + ${ZLIB_LIBRARY} + ${WINSOCK_LIBRARY} + ${RT_LIBRARY}) + endif() + + if(NOT SIMGEAR_HEADLESS) + set( TEST_LIBS + SimGearScene + ${TEST_LIBS}) + endif() else() message(STATUS "Tests: DISABLED") endif(ENABLE_TESTS) diff --git a/Doxyfile b/Doxyfile index d3577a36..edc9988a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -22,7 +22,7 @@ PROJECT_NAME = SimGear # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.2.0 +PROJECT_NUMBER = 2.11.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -56,7 +56,7 @@ EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. -EXTRACT_STATIC = NO +EXTRACT_STATIC = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. diff --git a/simgear/io/CMakeLists.txt b/simgear/io/CMakeLists.txt index 17483d63..8170b226 100644 --- a/simgear/io/CMakeLists.txt +++ b/simgear/io/CMakeLists.txt @@ -38,16 +38,6 @@ simgear_component(io io "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS) -if (SIMGEAR_SHARED) - set(TEST_LIBS SimGearCore) -else() - set(TEST_LIBS SimGearCore - ${CMAKE_THREAD_LIBS_INIT} - ${WINSOCK_LIBRARY} - ${ZLIB_LIBRARY} - ${RT_LIBRARY}) -endif() - add_executable(test_sock socktest.cxx) target_link_libraries(test_sock ${TEST_LIBS}) @@ -66,4 +56,5 @@ add_executable(test_binobj test_binobj.cxx) target_link_libraries(test_binobj ${TEST_LIBS}) add_test(binobj ${EXECUTABLE_OUTPUT_PATH}/test_binobj) + endif(ENABLE_TESTS) diff --git a/simgear/math/CMakeLists.txt b/simgear/math/CMakeLists.txt index 436b8f41..71a61cea 100644 --- a/simgear/math/CMakeLists.txt +++ b/simgear/math/CMakeLists.txt @@ -45,12 +45,6 @@ simgear_component(math math "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS) -if (SIMGEAR_SHARED) - set(TEST_LIBS SimGearCore) -else() - set(TEST_LIBS SimGearCore ${CMAKE_THREAD_LIBS_INIT}) -endif() - add_executable(math_test SGMathTest.cxx) target_link_libraries(math_test ${TEST_LIBS}) add_test(math ${EXECUTABLE_OUTPUT_PATH}/math_test) @@ -58,4 +52,5 @@ add_test(math ${EXECUTABLE_OUTPUT_PATH}/math_test) add_executable(geometry_test SGGeometryTest.cxx) target_link_libraries(geometry_test ${TEST_LIBS}) add_test(geometry ${EXECUTABLE_OUTPUT_PATH}/geometry_test) + endif(ENABLE_TESTS) diff --git a/simgear/misc/CMakeLists.txt b/simgear/misc/CMakeLists.txt index c2fbf60a..a58330f0 100644 --- a/simgear/misc/CMakeLists.txt +++ b/simgear/misc/CMakeLists.txt @@ -33,14 +33,6 @@ simgear_component(misc misc "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS) -if (SIMGEAR_SHARED) - set(TEST_LIBS SimGearCore) -else() - set(TEST_LIBS SimGearCore - ${CMAKE_THREAD_LIBS_INIT} - ${ZLIB_LIBRARY}) -endif() - 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 ${TEST_LIBS}) @@ -56,4 +48,5 @@ target_link_libraries(test_streams ${TEST_LIBS}) add_executable(test_path path_test.cxx ) add_test(test_path ${EXECUTABLE_OUTPUT_PATH}/test_path) target_link_libraries(test_path ${TEST_LIBS}) + endif(ENABLE_TESTS) diff --git a/simgear/nasal/cppbind/CMakeLists.txt b/simgear/nasal/cppbind/CMakeLists.txt index 32a08904..ac9e7e08 100644 --- a/simgear/nasal/cppbind/CMakeLists.txt +++ b/simgear/nasal/cppbind/CMakeLists.txt @@ -27,13 +27,6 @@ simgear_component(nasal/cppbind nasal/cppbind "${SOURCES}" "${HEADERS}") simgear_component(nasal/cppbind/detail nasal/cppbind/detail "" "${DETAIL_HEADERS}") if(ENABLE_TESTS) - -if (SIMGEAR_SHARED) - set(TEST_LIBS SimGearCore) -else() - set(TEST_LIBS SimGearCore ${CMAKE_THREAD_LIBS_INIT}) -endif() - add_executable(test_cppbind cppbind_test.cxx) add_test(test_cppbind ${EXECUTABLE_OUTPUT_PATH}/test_cppbind) target_link_libraries(test_cppbind ${TEST_LIBS}) diff --git a/simgear/props/CMakeLists.txt b/simgear/props/CMakeLists.txt index f6f3677c..c770f78f 100644 --- a/simgear/props/CMakeLists.txt +++ b/simgear/props/CMakeLists.txt @@ -29,12 +29,6 @@ simgear_component(props props "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS) -if (SIMGEAR_SHARED) - set(TEST_LIBS SimGearCore) -else() - set(TEST_LIBS SimGearCore ${CMAKE_THREAD_LIBS_INIT}) -endif() - add_executable(test_props props_test.cxx) target_link_libraries(test_props ${TEST_LIBS}) add_test(test_props ${EXECUTABLE_OUTPUT_PATH}/test_props) diff --git a/simgear/props/props_test.cxx b/simgear/props/props_test.cxx index 55783574..debf79d7 100644 --- a/simgear/props/props_test.cxx +++ b/simgear/props/props_test.cxx @@ -19,7 +19,7 @@ using std::cerr; using std::endl; - + //////////////////////////////////////////////////////////////////////// // Sample object. //////////////////////////////////////////////////////////////////////// @@ -38,7 +38,7 @@ private: }; - + //////////////////////////////////////////////////////////////////////// // Sample function. //////////////////////////////////////////////////////////////////////// @@ -48,7 +48,7 @@ static int get100 () { return 100; } static double getNum (int index) { return 1.0 / index; } - + //////////////////////////////////////////////////////////////////////// // Show a value. //////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ show_values (const SGPropertyNode * node) } - + //////////////////////////////////////////////////////////////////////// // Test individual values. //////////////////////////////////////////////////////////////////////// @@ -270,7 +270,7 @@ test_value () } - + //////////////////////////////////////////////////////////////////////// // Check property nodes. //////////////////////////////////////////////////////////////////////// diff --git a/simgear/scene/tgdb/CMakeLists.txt b/simgear/scene/tgdb/CMakeLists.txt index e514859c..cdf6a3de 100644 --- a/simgear/scene/tgdb/CMakeLists.txt +++ b/simgear/scene/tgdb/CMakeLists.txt @@ -41,11 +41,6 @@ set(SOURCES simgear_scene_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS) - if (SIMGEAR_SHARED) - set(TEST_LIBS SimGearCore) - else() - set(TEST_LIBS SimGearCore ${CMAKE_THREAD_LIBS_INIT}) - endif() add_executable(BucketBoxTest BucketBoxTest.cxx) target_link_libraries(BucketBoxTest ${TEST_LIBS}) diff --git a/simgear/scene/util/CMakeLists.txt b/simgear/scene/util/CMakeLists.txt index d10a4204..02d7766d 100644 --- a/simgear/scene/util/CMakeLists.txt +++ b/simgear/scene/util/CMakeLists.txt @@ -53,7 +53,9 @@ set(SOURCES simgear_scene_component(util scene/util "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS) + add_executable(test_parse_color parse_color_test.cxx ) add_test(test_parse_color ${EXECUTABLE_OUTPUT_PATH}/test_parse_color) -target_link_libraries(test_parse_color SimGearScene) +target_link_libraries(test_parse_color ${TEST_LIBS}) + endif(ENABLE_TESTS) diff --git a/simgear/sound/CMakeLists.txt b/simgear/sound/CMakeLists.txt index cbedeed6..a15c9110 100644 --- a/simgear/sound/CMakeLists.txt +++ b/simgear/sound/CMakeLists.txt @@ -24,14 +24,12 @@ simgear_scene_component(sound sound "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS AND ENABLE_SOUND) if (SIMGEAR_SHARED) - set(SOUND_TEST_LIBS SimGearScene) + set( SOUND_TEST_LIBS + ${TEST_LIBS}) else() set(SOUND_TEST_LIBS - SimGearScene SimGearCore - ${CMAKE_THREAD_LIBS_INIT} - ${RT_LIBRARY} - ${OPENAL_LIBRARY} - ${ZLIB_LIBRARY}) + ${TEST_LIBS} + ${OPENAL_LIBRARY}) endif() function(create_test TEST_NAME) diff --git a/simgear/structure/CMakeLists.txt b/simgear/structure/CMakeLists.txt index f7e29a76..0cc3f79d 100644 --- a/simgear/structure/CMakeLists.txt +++ b/simgear/structure/CMakeLists.txt @@ -44,15 +44,7 @@ set(SOURCES simgear_component(structure structure "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS) - -if (SIMGEAR_SHARED) - set(TEST_LIBS SimGearCore) -else() - set(TEST_LIBS SimGearCore ${CMAKE_THREAD_LIBS_INIT} - ${ZLIB_LIBRARY} - ${RT_LIBRARY}) -endif() - + add_executable(test_state_machine state_machine_test.cxx) target_link_libraries(test_state_machine ${TEST_LIBS}) add_test(test_state_machine ${EXECUTABLE_OUTPUT_PATH}/test_state_machine) @@ -61,5 +53,4 @@ add_executable(test_expressions expression_test.cxx) target_link_libraries(test_expressions ${TEST_LIBS}) add_test(test_expressions ${EXECUTABLE_OUTPUT_PATH}/test_expressions) - endif(ENABLE_TESTS) -- 2.39.5