Make the test_suite happier under MSBuild/VS
Use the CMake target as the command to invoke, so various things get set automatically, and set the MSVCIDE_RUN_PATH so DLLs are found correctly.
This commit is contained in:
parent
3e834ebb65
commit
22de9d30b5
2 changed files with 22 additions and 28 deletions
|
@ -607,14 +607,6 @@ CONFIGURE_FILE(
|
||||||
ADD_CUSTOM_TARGET(uninstall
|
ADD_CUSTOM_TARGET(uninstall
|
||||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
|
||||||
|
|
||||||
# The test suite.
|
# The test suite.
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(test_suite EXCLUDE_FROM_ALL)
|
add_subdirectory(test_suite EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
add_custom_target(test_suite
|
|
||||||
${TEST_SUITE_COMMAND}
|
|
||||||
DEPENDS fgfs_test_suite
|
|
||||||
WORKING_DIRECTORY ${TEST_SUITE_WORKING_DIRECTORY}
|
|
||||||
COMMENT ${TEST_SUITE_COMMENT}
|
|
||||||
)
|
|
||||||
|
|
|
@ -127,32 +127,34 @@ set_target_properties(fgfs_test_suite
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${TESTSUITE_OUTPUT_DIR}"
|
RUNTIME_OUTPUT_DIRECTORY "${TESTSUITE_OUTPUT_DIR}"
|
||||||
)
|
)
|
||||||
if(ENABLE_AUTOTESTING)
|
if(ENABLE_AUTOTESTING)
|
||||||
if(WIN32)
|
set(TEST_SUITE_COMMENT "Running the full FlightGear test suite")
|
||||||
set(TEST_SUITE_COMMAND "fgfs_test_suite.exe")
|
|
||||||
set(TEST_SUITE_WORKING_DIRECTORY "${TESTSUITE_OUTPUT_DIR}/${CMAKE_BUILD_TYPE}")
|
|
||||||
else()
|
|
||||||
set(TEST_SUITE_COMMAND "fgfs_test_suite")
|
|
||||||
set(TEST_SUITE_WORKING_DIRECTORY "${TESTSUITE_OUTPUT_DIR}")
|
|
||||||
endif(WIN32)
|
|
||||||
set(TEST_SUITE_COMMENT "Running the full FlightGear test suite: ${TEST_SUITE_WORKING_DIRECTORY}/${TEST_SUITE_COMMAND}")
|
|
||||||
else()
|
else()
|
||||||
set(TEST_SUITE_COMMENT "Building the FlightGear test suite.")
|
set(TEST_SUITE_COMMENT "Building the FlightGear test suite.")
|
||||||
endif(ENABLE_AUTOTESTING)
|
endif(ENABLE_AUTOTESTING)
|
||||||
set(TEST_SUITE_COMMAND
|
|
||||||
${TEST_SUITE_COMMAND}
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
set(TEST_SUITE_WORKING_DIRECTORY
|
|
||||||
${TEST_SUITE_WORKING_DIRECTORY}
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
set(TEST_SUITE_COMMENT
|
|
||||||
${TEST_SUITE_COMMENT}
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set up the target links.
|
# Set up the target links.
|
||||||
setup_fgfs_libraries(fgfs_test_suite)
|
setup_fgfs_libraries(fgfs_test_suite)
|
||||||
|
|
||||||
# Additional libraries just for the test suite.
|
# Additional libraries just for the test suite.
|
||||||
target_link_libraries(fgfs_test_suite ${CPPUNIT_LIBRARIES})
|
target_link_libraries(fgfs_test_suite ${CPPUNIT_LIBRARIES})
|
||||||
|
|
||||||
|
# target to run the tests
|
||||||
|
if (MSVC)
|
||||||
|
if (TARGET Qt5::qmake)
|
||||||
|
# property is the full path to qmake.exe
|
||||||
|
get_target_property(_qt5_qmake_path Qt5::qmake LOCATION)
|
||||||
|
get_filename_component(_qt5_bin_dir ${_qt5_qmake_path} DIRECTORY)
|
||||||
|
file(TO_NATIVE_PATH "${_qt5_bin_dir}" _qt5_bin_dir_native)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(TO_NATIVE_PATH "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/bin" _msvc_3rdparty_bin_dir)
|
||||||
|
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" _install_bin_dir)
|
||||||
|
|
||||||
|
set(CMAKE_MSVCIDE_RUN_PATH "${_install_bin_dir};${_msvc_3rdparty_bin_dir};${_qt5_bin_dir_native}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_target(test_suite
|
||||||
|
fgfs_test_suite
|
||||||
|
DEPENDS fgfs_test_suite
|
||||||
|
COMMENT ${TEST_SUITE_COMMENT}
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue