[CMake] Restrictions on where a binary can be put?

Nizar Khalifa Sallem nksallem at laas.fr
Sun Jan 9 16:48:34 EST 2011


At Sun, 9 Jan 2011 16:27:05 -0500,
Martin O'Brien wrote:
> 
> Thanks, Michael.
> 
> 
> Hmm.  I wonder what it is then, and why just today?
> 
> 
> mm
> 
> 
> 
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of
> Michael Hertling
> Sent: Sunday, January 09, 2011 4:27 PM
> To: cmake at cmake.org
> Subject: Re: [CMake] Restrictions on where a binary can be put?
> 
> On 01/09/2011 09:47 PM, Nizar Khalifa Sallem wrote:
> > At Sun, 09 Jan 2011 21:42:49 +0100,
> > Michael Hertling wrote:
> >>
> >> On 01/09/2011 09:09 PM, Andreas Pakulat wrote:
> >>> On 09.01.11 21:05:21, Andreas Pakulat wrote:
> >>>> On 09.01.11 14:24:16, Michael Hertling wrote:
> >>>>> On 01/09/2011 12:58 PM, Andreas Pakulat wrote:
> >>>>>> Hi,
> >>>>>>
> >>>>>> I'm having a bit of a problem here changing the runtime output
> directory
> >>>>>> for a binary. Its an executable target named 'setup' and I'd like to
> put it
> >>>>>> into the top-level directory. Unfortunately it always ends up in the
> bin/
> >>>>>> directory, which is what CMAKE_RUNTIME_OUTPUT_DIRECTORY is being set
> to.
> >>>>>>
> >>>>>> I'm using
> >>>>>>     set_target_properties( setup PROPERTIES RUNTIME_OUTPUT_DIRECTORY
> ${CMAKE_BINARY_DIR} )
> >>>>>> after creating the target currently, which should work as far as I
> can see
> >>>>>> from the documentation. Are there maybe any restrictions on what the
> >>>>>> directory may be or what targets can be put there?
> >>>>>>
> >>>>>> If not, any suggestions how to debug this? I can see that the
> build.make
> >>>>>> does already have the rule setup for putting the binary into bin/, so
> it
> >>>>>> must be going wrong somewhere in the generation stage, but a simple
> cmake
> >>>>>> --trace doesn't show up anything suspicious. Is there a switch to
> follow
> >>>>>> the steps that cmake does during makefile-generation?
> >>>>>
> >>>>> Could you provide a minimal but complete example?
> >>>>
> >>>> Ok, attached case produces the error. Apparently the problem is
> fetching
> >>>> the LOCATION property from the target and setting the
> >>>> RUNTIME_OUTPUT_DIRECTORY afterwards. Looks like a cmake bug to me, so
> >>>> I'll file a report.
> >>>
> >>> Ooops, forgot the attachment :)
> >>
> >> Now, I can confirm the issue; indeed, the GET_TARGET_PROPERTY() on the
> >> LOCATION apparently renders the following SET_TARGET_PROPERTY() on the
> >> RUNTIME_OUTPUT_DIRECTORY ineffective. As I cannot see any reason for
> >> this, I'd agree that it should be considered as a bug. Besides, my
> >> example was pointless: A simple clash of an executable "main" with
> >> a subdirectory of the same name in CMAKE_BINARY_DIR, sorry. :/
> >>
> >> Regards,
> >>
> >> Michael
> 
> > I don't really understand why you want to get the LOCATION from your
> > target, anyway, the get_target_property works fine if you use
> > set_target_properties before it. [...]
> 
> ...but SET_TARGET_PROPERTIES() doesn't work fine if it's used after
> GET_TARGET_PROPERTY(), even if both operate on different properties.
That point I can definitely exclude since I am using
set_target_properties on RUNTIME_OUTPUT_DIRECTORY along with
get_target_property on the file name havily in my
projects and it works fine even today. I am using cmake v2.8.3 (built)
on a ubuntu 10.10 and it did work fine with cmake v2.6.4.

> 
> > [...] I am not sure that the
> > CMAKE_RUNTIME_OUTPUT_DIRECTORY makes a property which is
> > "gettable". [...]
> 
> Why should any property be not gettable? Some are not settable, like
> the LOCATION, but that's not the point. The point is that getting a
> property, i.e. a read operation, should not have an impact on any
> subsequent command which does not use the former's results.
> 
> > [...] If you can better explain what do you want to do with the
> > LOCATION of your target may be someone can help.
> 
> Regards,
> 
> Michael
> 
> @ Martin O'Brien: On my side, everything works as usual.
> _______________________________________________
> 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

Best,
--
Nizar


More information about the CMake mailing list