[CMake] Interpretation of RUNTIME_OUTPUT_DIRECTORY in VisualStudio
Michael Jackson
mike.jackson at bluequartz.net
Tue Mar 17 09:06:12 EDT 2009
try the following:
ADD_CUSTOM_TARGET(QtLibs
COMMAND ${CMAKE_COMMAND} -E
copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/libQtCore.so.4
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}...)
• CMAKE_CFG_INTDIR: Build time configuration directory for project.
This is a variable that is used to provide developers access to the
intermediate directory used by Visual Studio IDE projects. For
example, if building Debug all executables and libraries end up in a
Debug directory. On UNIX systems this variable is set to ".". However,
with Visual Studio this variable is set to $(IntDir). $(IntDir) is
expanded by the IDE only. So this variable should only be used in
custom commands that will be run during the build process. This
variable should not be used directly in a CMake command. CMake has no
way of knowing if Debug or Release will be picked by the IDE for a
build type. If a program needs to know the directory it was built in,
it can use CMAKE_INTDIR. CMAKE_INTDIR is a C/C++ preprocessor macro
that is defined on the command line of the compiler. If it has a
value, it will be the intermediate directory used to build the file.
This way an executable or a library can find files that are located in
the build directory.
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
On Mar 17, 2009, at 8:40 AM, Martin Apel wrote:
> Hi all,
>
> I am trying to write CMake rules to copy shared libraries / DLLs to
> the
> runtime directory (not "installing"), right besides the binaries
> generated by my project. In order to do this, I have rules like the
> following:
> ADD_CUSTOM_TARGET(QtLibs
> COMMAND ${CMAKE_COMMAND}
> -E
> copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/libQtCore.so.4
> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}...)
>
> This works fine on Linux and Windows using the NMake generator.
> However,
> when using VisualStudio 8 under Windows, these libraries end up in the
> directory, where CMAKE_RUNTIME_OUTPUT_DIRECTORY points to, whereas the
> generated binaries are put into ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
> debug
> or /release.
>
> Is the interpretation of what the RUNTIME_OUTPUT_DIRECTORY property or
> the CMAKE_RUNTIME_OUTPUT_DIRECTORY means different for the Visual
> Studio
> generators? Do I have to put something like
> IF (MSVC80)
> ...
> ELSE(MSVC80)
> ...
> ENDIF(MSVC80)
>
> into my CMakeLists.txt? Or is there a better solution?
>
> Best Regards,
>
> Martin
>
>
>
> ____________
> Virus checked by G DATA AntiVirus
> Version: AVF 19.302 from 16.03.2009
>
>
> _______________________________________________
> 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