On 11. Jun, 2010, at 16:58 , Hickel, Kelly wrote:
> I'm using CMake 2.8.1 and I want to write a simple test for one of the
> executable targets, but it failes because the shared libraries aren't in the
> directory or on the path.
>
> So, with something like the below, where bar and baz are shared objects built
> by CMakeLists.txt files in other directories (building foo works just fine,
> BTW), how can I modify the test so that baz.dll and bar.dll are either in the
> same directory as foo.exe, or on the path (that was windows specific, but I
> want it to work everywhere):
>
> add_executable( foo foo.c )
> target_link_libraries( foo bar baz )
> add_test( NAME foo-simple COMMAND foo "--simple" )
>
> I was going to try setting that PATH environment var for the test, but
> haven't been able to come up with a get_target_property line that gets the
> correct directory where each dll file will be.
>
> I suppose I could invoke cmake to copy the binaries, but that doesn't seem
> ideal (and I still have to figure out where to copy from), I'd like not to
> leave extra dll copies lying around....
>
> Thanks,
> Kelly Hickel
>
> BMC Software
Either set CMAKE_RUNTIME_OUTPUT_DIRECTORY or the target property
RUNTIME_OUTPUT_DIRECTORY to e.g. ${CMAKE_BINARY_DIR}/bin. This will cause all
the files that are required during runtime to be created in the specified
directory. For other kinds of files, there are similarly-named variables and
properties.
HTH
Michael
_______________________________________________
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