[CMake] copy generated dll in executable directory

Michael Jackson mike.jackson at bluequartz.net
Mon Feb 9 11:46:13 EST 2009


You probably want something like the following in your CMake file



# ---------- Setup output Directories -------------------------
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
   ${PROJECT_BINARY_DIR}/Bin
   CACHE PATH
   "Single Directory for all Libraries"
   )

# --------- Setup the Executable output Directory -------------
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
   ${PROJECT_BINARY_DIR}/Bin
   CACHE PATH
   "Single Directory for all Executables."
   )

# --------- Setup the Executable output Directory -------------
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
   ${PROJECT_BINARY_DIR}/Bin
   CACHE PATH
   "Single Directory for all static libraries."
   )


_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Feb 9, 2009, at 11:31 AM, Benoit wrote:

> Hy!
>
> I'm doing a project where I'm generating 2 libraries for differents  
> application. The problem is that the dll and the executable are not  
> in the same directory. Therefore if i need to copy the dll each time  
> i want to recompile them.
>
>
> The tree of my project is the following.
>
> ./CMakeList.txt (A)
> ./my/
> ./my/lib1/CmakeList.txt (B)
> ./my/lib2/
> ./test1
> ./test2
>
>
> And in the file CMakeList.txt (A), I have:
>
> set( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
> set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/bin )
>
>
> I've found some help on the web and now i I use the install target  
> in the Makefile to copy the .dll in the binary directory.
>
> And in CmakeList.txt (B)
>
> INSTALL( TARGETS ${LIBNAME} DESTINATION . PERMISSIONS
> OWNER_READ OWNER_WRITE OWNER_EXECUTE
> GROUP_READ GROUP_EXECUTE
> WORLD_READ WORLD_EXECUTE )
>
>
> However, i would like to have them directly in the executable output  
> path. Using the target all should be sufficient to generate the  
> executable and the new dll in the same directory.
>
>
> Thanks,
>
> --
> Benoit RAT
> www.neub.co.nr
> _______________________________________________
> 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



More information about the CMake mailing list