[CMake] ctest, make test and build config

ross hennessy roscoh at gmail.com
Tue May 18 03:37:32 EDT 2010


Hi,

I would like to add a test to my project (using ADD_TEST) and have it
"load" files from other directories in the project. These other files
that I would like it to load are library files (built by other targets
in the project) and config files (created by other targets). These
files are located in
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}, which as I'm on
windows (I don't think this gets set on linux?), evaluates to either
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug or
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release. So I would like my test to
have this information, and how I've tried doing this so far is to
supply a parameter to the test eg.
ADD_TEST( MyTest MyTest -p \${CMAKE_BUILD_TYPE} )

I've tried a variety of variable names in place of the
CMAKE_BUILD_TYPE and none of them evaluate to anything at the time of
running the test! Am I going about this the wrong way? I've looked
into the RUN_TESTS project properties to try and see what was going on
and I found the post build command ctest --force-new-ctest-process, so
I was wondering if the build type gets lost due to the process
spawning?

Thanks, Ross


More information about the CMake mailing list