[CMake] dependency in custom command?

King, Steven R steven.r.king at intel.com
Mon Aug 31 01:08:14 EDT 2009


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

Again my goal is to simply bring a dll and it's test program together so they run happily ever after.

Thanks,
-steve



More information about the CMake mailing list