[cmake-developers] Generator Expressions in CPack (Module) variables

Eric Noulard eric.noulard at gmail.com
Tue Apr 28 05:08:21 EDT 2015


2015-04-28 10:57 GMT+02:00 Gregor Jasny <gjasny at googlemail.com>:

> Hello Nils,
>
> thank you for the pointers.
>
> On 24/04/15 21:30, Nils Gladitz wrote:
>
>> On 24.04.2015 20:55, Gregor Jasny wrote:
>>
>>> Hello,
>>>
>>> would it be possible to add generator expression support to CPack
>>> so that I can use $<CONFIG> within CPACK_PACKAGE_FILE_NAME? I'm
>>> using the CPack module from within my CMakeLists.txt.
>>>
>>

>From my understanding $<CONFIG> is a build time value.
evaluating $<CONFIG> at CPack time may be hard because
one can simply call:

cpack -G <generator>

then <CONFIG> definition is implicit and only known when the build tool is
called...




>
>>> I'm trying to generate unique file names per architecture and
>>> configuration but multi config generators like Xcode make this
>>> harder than expected.
>>>
>>
>> You should be able to do this without generator expressions and just
>> CPACK_PROJECT_CONFIG_FILE [1] and CPACK_BUILD_CONFIG [2].
>> If you really do require/want generator expressions you should be able
>> to combine that with file(GENERATE) and include().
>>
>
> Unfortunately the CPACK_BUILD_CONFIG approach does only work for
> multi-config generators. As far as I understand CPACK_BUILD_CONFIG gets
> only set if the -C command line option was given to cpack. But this option
> is only added conditionally and omitted for Makefile builds:
>
>  void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
>> ...
>>   if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' )
>>     {
>>     singleLine.push_back("-C");
>>     singleLine.push_back(cmakeCfgIntDir);
>>     }
>>
>
> Now I'm just wondering if conditionally setting -C / CPACK_BUILD_CONFIG is
> the right thing to do?
>

If it is possible to always define it may be it could be done.
Beware of backward compatibility issue though.


-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150428/f56756b6/attachment.html>


More information about the cmake-developers mailing list