[CMake] CTest on Windows

Xavier Decoret x.decoret at me.com
Thu Feb 10 07:54:13 EST 2011


I am trying to run test on Windows (using the NMake generator and Visual Studio) and encounter several problems:

First 'nmake test' does not run the tests, as it does on other platforms (Unix w/ make generators).

Then, when I manually run ctest from the PROJECT_BINARY_DIR, the test will fail because the dependent libraries (dynamic libraries generated by the target) are not in the path. 

On Unix platform, I do not have the issue: the rpath is set correctly when I use the target_link_libraries().

What should I do on Windows? The only solution I see for the moment is to 'nmake install' the tests and run fixup_bundle() on them. Another solution is to manually maintain the list of path of DLLs and try to pass it to CTest. But I cannot find a way to do that from cmake. Besides, those DLLs are scattered around the build tree. Another solution would be to force all libraries and binaries in a single directory using the RUNTIME_OUTPUT_DIRECTORY variable.

What would you recommend?

PS: It is pretty common to generate a library that is linked with a main executable, and linked with a test executable. I am pretty sure this is handled by cmake/ctest. 



More information about the CMake mailing list