[cmake-developers] Generator expressions for <archive|library|runtime> output directory

Robert Goulet Robert.Goulet at autodesk.com
Fri Jul 17 10:55:12 EDT 2015


Ok I'd like to fix the crash, what is the clean way to deal with this kind of situation? I'm guessing this might be a problem that was solved elsewhere for other cases before?

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Friday, July 17, 2015 10:44 AM
To: Robert Goulet
Cc: Stephen Kelly; cmake-developers at cmake.org
Subject: Re: [cmake-developers] Generator expressions for <archive|library|runtime> output directory

On 07/15/2015 05:27 PM, Robert Goulet wrote:
> I didn't know about the two signature of 
> cmCompiledGeneratorExpression::Evaluate, what's the difference?
> 
> As for the TARGET_PROPERTY generator expression, are you suggesting 
> this could potentially be an issue? I haven't tried it.

If cmCompiledGeneratorExpression::Evaluate is given the current target ("this") as the headTarget then one can use the TARGET_PROPERTY generator expression to refer to other properties on the target whose name is being determined.  This would be nice to have but could also be enabled by future changes so I won't insist on it now.

Your original patch did not evaluate the generator expressions in quite the right place.  On Wednesday I had updated the patch and applied for testing in 'next':

 Add genex for {ARCHIVE,LIBRARY,RUNTIME}_OUTPUT_DIRECTORY[_<CONFIG>]
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6f05443

Although testing was clean, I reverted the change from 'next'
this morning after Steve's review led me to realize that the change causes a crash in a self-reference case like:

 set_property(TARGET myexe PROPERTY RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:myexe>)

This is also a problem for the recent OUTPUT_NAME changes:

 set_property(TARGET myexe PROPERTY OUTPUT_NAME $<TARGET_FILE_NAME:myexe>)

In each case the implementation fails to diagnose the ill-defined self-reference case.  Fixing these cases may require some kind of check in cmTarget methods to see if they end up being called recursively.

Thanks,
-Brad


More information about the cmake-developers mailing list