[cmake-developers] CPack: GetPrerequisites: cross-compiling from Linux to Windows

Eric Noulard eric.noulard at gmail.com
Tue Mar 6 08:27:05 EST 2012


2012/3/6 Dominik Schmidt <domme at tomahawk-player.org>:
> Hey Eric,
>
> thanks for the quick reply!

You are welcome.

>> > This is the reason my code in the patch is not in the WIN32 block above
>> > and
>> > I couldn't guess the gp_tool correctly.
>>
>> In order to be sure that nothing else is breaking you can try to
>> [manually] add the missing definition in the CPackConfig.cmake file.
>> This file is loaded by CPack at CPack-time so that any definitions in
>> there
>> will be seen during CPack run.
>
> Went fine.
>
>> An alternative would be to do it in a CPack Project Config file:
>>
>> http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29
>
> Might make sense, indeed. That way you could explicitly say if you want to
> cross-package or not.

It is even necessary for more than "just testing" because the
CPackConfig.cmake file may be
overwritten by CPack next time you change your CMakeLists.txt.

CPackConfig.cmake is "generated" by the
include(CPack)
in your CMakeLists.txt.

Ultimately it may be useful to "configure_file" your
CPackProjectConfig.cmake.[in]
and put some generated logic in it depending on any CMake variable.

>> > The patch is probably not ready to be upstreamed but I'm happy to fix
>> > issues
>> > or follow a nicer approach if you point me to it.
>>
>> Before going on may be you could explain us what kind of
>> cross-packaging your are targeting:
>> NSIS, Archive generator, etc...
>
> NSIS is the one I'm aiming for :-)

Ok.

>> Setting WIN32 and/or CMAKE_CROSSCOMPILING may be done in CPack list
>> interpreter
>> but it remains to be seen whether it would be enough in order to
>> achieve what you want.
>
>
> I think so, it already works when gp_tool is manually set to objdump!

If you manage to do that kind of cross-packaging it could be worth a
page on the Wiki.

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org



More information about the cmake-developers mailing list