[CMake] dependency in custom command?

Philip Lowman philip at yhbt.com
Mon Aug 31 08:20:24 EDT 2009


On Mon, Aug 31, 2009 at 1:08 AM, King, Steven R <steven.r.king at intel.com>wrote:

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


What we do at work is generate the test binaries in
CMAKE_RUNTIME_OUTPUT_DIRECTORY as well.  This does tend to clutter up that
directory but they don't get make installed so it's not a huge issue for us.

You might be able to use the ENVIRONMENT test property to append to the PATH
environment variable CMAKE_RUNTIME_OUTPUT_DIRECTORY.  This would allow the
test binaries (in theory) to find their dependent DLLs while not existing in
CMAKE_RUNTIME_OUTPUT_DIRECTORY.

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090831/56cb0174/attachment.htm>


More information about the CMake mailing list