CMake: Create list of libs for testing only once

This commit is contained in:
Thomas Geymayer
2013-03-15 23:21:38 +01:00
parent d2c03a6651
commit e08eda18d5
12 changed files with 37 additions and 67 deletions

View File

@@ -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)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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})

View File

@@ -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)

View File

@@ -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.
////////////////////////////////////////////////////////////////////////

View File

@@ -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})

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)