[CMake] CTest on Windows

David Cole david.cole at kitware.com
Thu Feb 10 10:04:55 EST 2011


On Thu, Feb 10, 2011 at 7:54 AM, Xavier Decoret <x.decoret at me.com> wrote:

> 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?
>

Putting all the dlls and exes into a single directory is the easiest thing
to do if you don't mind reorganizing your build tree...

If you must keep your build tree, another strategy would be to run all your
tests through a script that drives the test rather than calling the
executable directly. Then, in that script, you could set the PATH env var to
include all the directories where all the dlls are located.


HTH,
David



>
> 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.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110210/0a3b7099/attachment.htm>


More information about the CMake mailing list