1
0
Fork 0

Test Suite: Workaround for aberrant MS Windows CMake behaviour.

The add_custom_target() CMake function for the test_suite target has been
shifted from test_suite/CMakeLists.txt to the top level CMakeLists.txt file.
The variable setting CMake code required for this has also been shifted.  This
allows for the same build command 'cmake --build .  --target test_suite' to work
on all operating systems.
This commit is contained in:
Edward d'Auvergne 2019-09-17 21:41:01 +02:00
parent 8120dcb4c9
commit f6efeb3f34
2 changed files with 20 additions and 19 deletions

View file

@ -611,3 +611,23 @@ ADD_CUSTOM_TARGET(uninstall
# The test suite.
enable_testing()
add_subdirectory(test_suite EXCLUDE_FROM_ALL)
if(ENABLE_AUTOTESTING)
set(TEST_SUITE_COMMENT "Running the full FlightGear test suite.")
if(WIN32)
set(TEST_SUITE_COMMAND "run_test_suite.exe")
set(TEST_SUITE_WORKING_DIRECTORY "${TESTSUITE_OUTPUT_DIR}/${CMAKE_BUILD_TYPE}")
else()
set(TEST_SUITE_COMMAND "run_test_suite")
set(TEST_SUITE_WORKING_DIRECTORY "${TESTSUITE_OUTPUT_DIR}")
endif(WIN32)
else()
set(TEST_SUITE_COMMENT "Building the FlightGear test suite.")
endif(ENABLE_AUTOTESTING)
add_custom_target(test_suite
${TEST_SUITE_COMMAND}
DEPENDS run_test_suite
WORKING_DIRECTORY ${TEST_SUITE_WORKING_DIRECTORY}
COMMENT ${TEST_SUITE_COMMENT}
)

View file

@ -126,25 +126,6 @@ set_target_properties(run_test_suite
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${TESTSUITE_OUTPUT_DIR}"
)
if(ENABLE_AUTOTESTING)
set(TEST_SUITE_COMMENT "Running the full FlightGear test suite.")
if(WIN32)
set(TEST_SUITE_COMMAND "run_test_suite.exe")
set(TEST_SUITE_WORKING_DIRECTORY "${TESTSUITE_OUTPUT_DIR}/${CMAKE_BUILD_TYPE}")
else()
set(TEST_SUITE_COMMAND "run_test_suite")
set(TEST_SUITE_WORKING_DIRECTORY "${TESTSUITE_OUTPUT_DIR}")
endif(WIN32)
else()
set(TEST_SUITE_COMMENT "Building the FlightGear test suite.")
endif(ENABLE_AUTOTESTING)
add_custom_target(test_suite
${TEST_SUITE_COMMAND}
DEPENDS run_test_suite
WORKING_DIRECTORY ${TEST_SUITE_WORKING_DIRECTORY}
COMMENT ${TEST_SUITE_COMMENT}
)
# Set up the target links.
setup_fgfs_libraries(run_test_suite)