[CMake] RUNTIME_OUTPUT_DIRECTORY_<CONFIG> has no effect

Nizar Khalifa Sallem nksallem at laas.fr
Fri Jan 7 07:18:00 EST 2011


At Fri, 07 Jan 2011 13:08:44 +0100,
Martin Magnusson wrote:
> 
> 2011-01-07 12:07, Nizar Khalifa Sallem skrev:
> > At Fri, 07 Jan 2011 11:11:18 +0100,
> > 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.
> > Hi,
> > Actually you can do something like this:
> > set_property(GLOBAL TARGET target1, target2, ...
> > PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
> > ${PROJECT_BINARY_DIR}/bin/relwithdebinfo)
> 
> I tried that just now, but then CMake exits with the message
> 
> CMake Error at CMakeLists.txt:8 (SET_PROPERTY):
>   set_property given names for GLOBAL scope.
> 
> _______________________________________________
> 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
From the doc if you use GLOBAL keyword you should not put target
names.
Also it builds in source since PROJECT refers to your project name so
if you said Project(FOO) then you should use
${FOO_BINARY_DIR}/bin/relwithdebinfo that is I think the reason why it
had no effects.

Best,
--
Nizar


More information about the CMake mailing list