[CMake] runtime dependencies for tests

Michael Hertling mhertling at online.de
Tue Jan 31 21:19:44 EST 2012


On 01/31/2012 02:43 PM, Massaro Alessio wrote:
> Hi There
> 
> I googled near and far, but could not find a way to tell CTest where to find the 3rd-party DLLs required to run the test executables.
> In particular my executable targets link with a few Boost DLLs/SOs and obviously require them to run.
> 
> I understand on the Linux/Solaris I can use RPATH support in CMake.
> But I can't find a way to do it on my primary target platform, WIN32-msvc9.
> 
> I've already tried several variants of calling configure_file in a function the following way:
> 
>        configure_file("${some_dbg_boost_dll_file}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}" COPYONLY)
> 
> I'm open to all sorts of solutions: copy DLLs in place, set the PATH environment variable, ... anything!
> 
> I just need a pointer to show me some way to do it.
> 
> Thank you in advance!

IMO, the easiest approach is to use the ENVIRONMENT test property to
tweak the PATH environment variable for the tests, e.g. by appending/
prepending ${Boost_LIBRARY_DIRS} etc. A more radical but cumbersome
approach is to use the BundleUtilities to perform a completed test
installation - preferably beneath the build tree - and run the tests
therein. Finally, you might copy the required libraries to the build
tree by a custom target or custom commands, or by a test on its own
in conjunction with the DEPENDS test property, but that's even more
cumbersome.

Regards,

Michael


More information about the CMake mailing list