[CMake] Tests not added to CTestTestfile.cmake on OS X
Philipp Schröter
philipp.schroeter at charite.de
Thu Oct 16 06:17:38 EDT 2014
Dear all,
I'm encountering a problem when adding tests with add_test for CTest on
OS X 10.9.4. The CTestTestfile.cmake, which should contain the tests,
only has the header, but is empty otherwise (the ones in the directories
above, just include the other directories correctly).
On Windows with Visual Studio all runs fine.
The code looks like this
include_directories(${Boost_INCLUDE})
add_executable(Basic-Tests MACOSX_BUNDLE Vector-Test.cpp)
target_link_libraries(Basic-Tests Basic ${Boost_LIBRARIES})
SET_PROPERTY(TARGET Basic-Tests PROPERTY FOLDER "Tests")
if(Darwin OR APPLE)
add_test(NAME Basic-Debug-Tests
CONFIGURATIONS Debug-iphonesimulator
COMMAND
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/Basic-Tests.app/Basic-Tests"
${test_parameters} --log_sink=${test_log}/Basic-Tests.xml)
add_test(NAME Basic-Release-Tests
CONFIGURATIONS Release-iphonesimulator
COMMAND
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/Basic-Tests.app/Basic-Tests"
${test_parameters} --log_sink=${test_log}/Basic-Tests.xml)
else()
add_test(NAME Basic-Debug-Tests
CONFIGURATIONS Debug
COMMAND
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/Basic-Tests" ${test_parameters}
--log_sink=${test_log}/Basic-Tests.xml)
add_test(NAME Basic-Release-Tests
CONFIGURATIONS Release
COMMAND
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/Basic-Tests"
${test_parameters} --log_sink=${test_log}/Basic-Tests.xml)
endif()
CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG and
CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE are set to
${CMAKE_BINARY_DIR}/Debug/bin and ${CMAKE_BINARY_DIR}/Release/bin before
the call of add_test (and it is known at this location). The files and
locations are correct as far as I can see (e.g. when printed as a message).
test_parameters are some arguments for the test runner (I use the Boost
Test Framework).
enable_testing() is called in the CMakeLists.txt in the the top level
source directory.
So far, I tried different configurations (Debug and Release,
Release-iphoneos), checked the COMMAND argument and I also tried to use
a single test with the same name as the executable target instead of two
seperate ones.
The tests themselves are build correctly and do run with CTest, if they
are added manually (and the file is not overwritten before the tests run).
I am not sure, what the problem exactly is and what else to try to get
to the root of it (or just to solve it). Thank you very much for all
your help.
Best regards,
Philipp
PS: The CMake version on the Mac system is 3.0.0
More information about the CMake
mailing list