[CMake] RUNTIME_OUTPUT_DIRECTORY_<CONFIG> has no effect

David Cole david.cole at kitware.com
Fri Jan 7 07:34:42 EST 2011


If you are having an "in source build" happen where you do not intend it to,
then you probably have an unintended CMakeCache.txt in the source tree. Get
rid of the build remnants from your source tree and try another out of
source build...

HTH,
David


On Fri, Jan 7, 2011 at 7:08 AM, Martin Magnusson <martin at eyra.se> wrote:

> 2011-01-07 11:53, Andreas Pakulat skrev:
> > On 07.01.11 11:11:18, Martin Magnusson wrote:
> >> I'm having trouble setting the runtime output directory, especially with
> >> multiple configurations.
> >>
> >> I'm using CMake 2.8 on Ubuntu 10.04, with gcc.
> >>
> >> My current root CMakeLists.txt contains
> >> SET( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
> >> which works, although the EXECUTABLE_OUTPUT_PATH is deprecated.
> >>
> >> If I read the documentation correctly, the proper way of setting the
> >> output directory now would be
> >> SET_PROPERTY( GLOBAL PROPERTY
> >>   RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
> >> )
> >> but that doesn't work for me. With that setting, the binary is produced
> >> in the source directory, just as if I hadn't specified an output
> >> directory at all.
> >
> > Thats because that variable is not a global property. If you look at the
> > cmake manual you'll see it listed under the target-properties heading. So
> > you have to set this for each target (or wrap your target-creation in a
> > macro to set it automatically).
>
> Thanks a lot for your help. Using
>  SET_TARGET_PROPERTIES( target PROPERTIES
>    RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
>  )
> does work. However,
>  SET_TARGET_PROPERTIES( target PROPERTIES
>    RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
> ${PROJECT_BINARY_DIR}/bin/relwithdebinfo
>  )
> still makes an in-source build.
>
>
> > PS: To set the global value once, simply prefix it with CMAKE_ as
> > documented in the manual.
>
> Do you mean like this?
>  SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
> ${PROJECT_BINARY_DIR}/bin/relwithdebinfo )
> I tried that, but that also had no effect.
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110107/6ea44ab2/attachment-0001.htm>


More information about the CMake mailing list