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

Brad King brad.king at kitware.com
Fri Jul 17 11:46:48 EDT 2015


On 07/17/2015 10:55 AM, Robert Goulet wrote:
> 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?

I don't recall other cases where this specific problem has come
up.  There is code to deal with generator expression reference
cycles e.g. for $<TARGET_PROPERTY:...> expressions but that is
not quite the same thing.

For the OUTPUT_DIRECTORY case the GetOutputInfo method:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmTarget.cxx;hb=v3.3.0-rc4#l2612

memoizes the ComputeOutputDir result in a map.  Currently it does
not update the map until after computing the value.  You could
try teaching it to insert a placeholder (empty?) value in the map
first.  Then in the check for an existing map entry, if it is found
to contain the placeholder then you know recursion is occurring
and you can diagnose it with an error message and return early.

The GetOutputName method could be refactored to use a map and then
work the same way.

Thanks,
-Brad



More information about the cmake-developers mailing list