[cmake-developers] Generator Expressions in CPack (Module) variables
Gregor Jasny
gjasny at googlemail.com
Tue Apr 28 04:57:14 EDT 2015
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.
>>
>> 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?
Thanks,
Gregor
More information about the cmake-developers
mailing list