The easiest way to do this is to build all your dlls and exes into the same
location by setting the *_OUTPUT_DIRECTORY variables. VTK has a chunk of
code like this right at the top of its CMakeLists file to do this:

  if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${VTK_BINARY_DIR}/bin")
  endif()
  if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
    if(UNIX)
      set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${VTK_BINARY_DIR}/lib")
    else()
      set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${VTK_BINARY_DIR}/bin")
    endif()
  endif()
  if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${VTK_BINARY_DIR}/lib")
  endif()
  mark_as_advanced(CMAKE_RUNTIME_OUTPUT_DIRECTORY
    CMAKE_LIBRARY_OUTPUT_DIRECTORY
    CMAKE_ARCHIVE_OUTPUT_DIRECTORY
    )




On Fri, Nov 16, 2012 at 5:18 PM, Thomas Nilsson <
[email protected]> wrote:

> On DLL platforms (Windows and Cygwin) shared libraries are found through
> the PATH and not in some .../lib directory. (There the link stubs are kept.)
>
> If I build a shared library in one part of my build tree how can I make
> sure that this is the DLL that will be loaded when I run an executable from
> some other part of my build tree using cmake?
>
> This would mean that the PATH need to be set so I can do that if I run
> from the command line. But is it possible to modify the PATH from within
> Cmake so that e.g. tests always use the correct DLL?
>
> /Thomas
>
> --
>
> 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
>
--

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