[CMake] Simple CPack example is needed...

Eric Noulard eric.noulard at gmail.com
Mon Oct 20 15:44:26 EDT 2008


2008/10/20 Dick Munroe <munroe at csworks.com>:
> And once I keep CPack.make from clobbering CPACK_INSTALL_CMAKE_PROJECTS I
> get kits built as well.
>
> Here's something simple you can try to see the problem:
>
> project(foo)
>
>              ...
>
>               set(
>                         CPACK_INSTALL_CMAKE_PROJECTS
> "${CMAKE_HOME_DIRECTORY};ESPlanner-Web;WEB;/tmp/ESPlanner-install"
>                 )
>
>              message("x: ${CPACK_INSTALL_CMAKE_PROJECTS})
>
>              include(CPack)
>
>              message("x: ${CPACK_INSTALL_CMAKE_PROJECTS})
>
> When you configure your Makefiles (this particular build is for Darwin,
> running make) you'll see that after the include, the value for
> CPACK_INSTALL_CMAKE_PROJECTS is now null (I'm not building any source
> releases) because it's been overwritten by the contents of the
> CPACK_SOURCE_INSTALL_CMAKE_PROJECTS variable.  After the overwriting of
> CPACK_INSTALL_CMAKE_PROJECTS, there is a call to configure_file which is
> where I think that the bogus value of CPACK_INSTALL_CMAKE_PROJECTS gets
> written, resulting in the error.
>
> When you run the package command for the make file one (or at least I) get
> the error described below, in effect, CPack appears to have no data
> available from CPACK_INSTALL_CMAKE_PROJECTS set prior to the include of
> CPack.  If you make the change to CPack.cmake, described below, you get the
> correct behavior (or at least you get kits built which is what this is all
> about after all).  I'm just describing observed behavior with the shipped
> 2.6.2 product on Darwin (10.5.4+) not stating what other folks do or don't
> see.  As near as I can tell from the sparse CPack documentation all I should
> have to do is set CPACK_INSTALL_CMAKE_PROJECTS, which I do, run make
> package, which I do, and get kits, which I don't.

OK Dick,
If I use your example (setting CPACK_INSTALL_CMAKE_PROJECTS before
include CPack)
  I'm able reproduce the described behavior, I must admit I did never set
CPACK_INSTALL_CMAKE_PROJECTS myself.

You are right the behavior is weird, but I think it shouldn't lead to an error.

When you set CPACK_INSTALL_CMAKE_PROJECTS before including(CPack)
the value is used for generating the  CPackConfig.cmake file (the one
used for BINARY packages)
generated at line CPack.cmake:199

configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}"
@ONLY IMMEDIATE)

[and in fact the generated file CONTAINS the value you set]

Now at line CPack.cmake 209:
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")

the variable is "reset" with the value of
CPACK_SOURCE_INSTALL_CMAKE_PROJECTS (note the SOURCE)
because at lines CPack.cmake 218 configure_file("${cpack_source_input_file}"
                                              219
"${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)

you generate the CPackSourceConfig.cmake (the one used for SOURCE packages)

So YES the variables is reset by INCLUDE(CPack) but this is not a bug,
just a weird feature because
Source package and Binary package CPack config files shares the
"CPACK_INSTALL_CMAKE_PROJECTS".

If you want to specify CPACK_INSTALL_CMAKE_PROJECTS you need to specify BOTH

CPACK_INSTALL_CMAKE_PROJECTS
and
CPACK_SOURCE_INSTALL_CMAKE_PROJECTS
yourself.

However I don't even know what would be the meaning of
"CPACK_SOURCE_INSTALL_CMAKE_PROJECTS"
for a SOURCE package since there is NO INSTALL for a SOURCE package???

> I initially tried just including CPack and running make package, but got the
> same error (there is no data in CPACK_INSTALL_CMAKE_PROJECTS).

In this case on a Linux + TGZ/ZIP/RPM/DEB CPack  package generator
I do not have ANY error when running

make package
or
make package_source  (not available for RPM or DEB though)

I would say that this looks like a PackageMaker/OS X specific bug.
May be you should file a bug report
may be affer  trying the attached project which works well for me.


-- 
Erk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo-0.1.1-Source.tar.gz
Type: application/x-gzip
Size: 430 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081020/806baefe/attachment.bin>


More information about the CMake mailing list