On 08/30/2009 11:08 PM, King, Steven R wrote:
Can't you put all executables and shared libraries in one directory, so they
are all local to each other?
In the top level CMakeLists.txt file just add
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

The executables you specify in ADD_TEST() will have a working directory that
is ${CMAKE_CURRENT_BINARY_DIR}
Thanks Clint and Tyler and others for your patient help.  The consolidated 
binary directory didn't work.

I now put all my binaries and libraries in ${CMAKE_BINARY_DIR}/bin as Clint 
suggested.  This caused ctest to fail for lack of knowing where the test binary 
went.  I made this adjustment:

add_test    (
             test_my_module
             ${CMAKE_BINARY_DIR}/bin/test_my_module
             )

which allowed ctest to find the executable.  However, the executable still 
can't find the dll, since ctest runs the test from ${CMAKE_CURRENT_BINARY_DIR} 
which is apparently not equal to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}.  As we've 
just belabored, putting the dll in ${CMAKE_CURRENT_BINARY_DIR} is neither easy 
nor well advised.

OK, now I'm actually getting worried.  Any other ideas, please?

How about this:

add_test (test_my_module test_my_module ${CMAKE_BINARY_DIR}/bin)

Then in your main(int, char*[]), you can use argv[1] as the path to load the shared/dynamic library from.

Clint

_______________________________________________
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

Reply via email to