[CMake] Running library tests under MSVC2010
Martin Sustrik
sustrik at 250bpm.com
Mon Oct 22 08:44:58 EDT 2012
Hi Nils,
> It isn't as bad as I might have made it sound. e.g.:
>
> add_executable(mytest test.cpp)
> set_target_properties(mytest PROPERTIES RUNTIME_OUTPUT_DIRECTORY
> ${CMAKE_BINARY_DIR})
> add_test(mytest ${CMAKE_BINARY_DIR}/mytest)
Yes. Everything works OK now. My question was more of a theoretical
interest...
> On unix (I'm not sure about all but at least on gnu linux) CMake
> "tweaks" by embedding library paths into executables (RPATH) which
> allows the OS to use those paths at runtime.
> As far as I know there is no equivalent feature on windows(?)
The reason why I expected it to "just work" under MSVC is that when
working with MSVC without CMake, creating a dependency in test on the
library makes test automatically load the library even though it is not
on the system path. I have no idea how it works, I would expect MSVC IDE
simply to add relevant library to the path when running the test.
Anyway, with CMake-generated solution this doesn't seem to work. The
dependency is generated as expected, however, when trying to run the
test MSVC is unable to find the library.
Martin
More information about the CMake
mailing list