Empty CPack variables

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Empty CPack variables

Pau Garcia i Quiles
Hello,

I am using CMake 2.8.11.2 on Windows to build and package some software. If I do this, it works fine:

   set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Wt binary build")
   set(CPACK_PACKAGE_VENDOR "emweb bvba")
   set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
   set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
   set(CPACK_PACKAGE_VERSION_MAJOR "3")
   set(CPACK_PACKAGE_VERSION_MINOR "3")
   set(CPACK_PACKAGE_VERSION_PATCH "1")
   set(CPACK_PACKAGE_INSTALL_DIRECTORY "Wt ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
   set(CPACK_GENERATOR "ZIP;NSIS")
   include(CPack)

But if I add this line before include(CPack):

  set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")

then CPACK_PACKAGE_NAME, CPACK_PACKAGE_VERSION and CPACK_SYSTEM_NAME are empty and the file is generated as "---.zip" / "---.exe". Am I doing something wrong? (I want to add a couple more variables in the CPACK_PACKAGE_FILE_NAME variable to specify compiler and compiler version, that's why I'm composing CPACK_PACKAGE_FILE_NAME)

Thank you

--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Empty CPack variables

Eric Noulard
2013/10/6 Pau Garcia i Quiles <[hidden email]>:

> Hello,
>
> I am using CMake 2.8.11.2 on Windows to build and package some software. If
> I do this, it works fine:
>
>    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Wt binary build")
>    set(CPACK_PACKAGE_VENDOR "emweb bvba")
>    set(CPACK_PACKAGE_DESCRIPTION_FILE
> "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
>    set(CPACK_RESOURCE_FILE_LICENSE
> "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
>    set(CPACK_PACKAGE_VERSION_MAJOR "3")
>    set(CPACK_PACKAGE_VERSION_MINOR "3")
>    set(CPACK_PACKAGE_VERSION_PATCH "1")
>    set(CPACK_PACKAGE_INSTALL_DIRECTORY "Wt
> ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
>    set(CPACK_GENERATOR "ZIP;NSIS")
>    include(CPack)
>
> But if I add this line before include(CPack):
>
>   set(CPACK_PACKAGE_FILE_NAME
> "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
>
> then CPACK_PACKAGE_NAME, CPACK_PACKAGE_VERSION and CPACK_SYSTEM_NAME are
> empty and the file is generated as "---.zip" / "---.exe".

I think your conclusion is flawed.

doing
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")

in your CMakeLists.txt will set CPACK_PACKAGE_FILE_NAME to "--"
BECAUSE
CPACK_PACKAGE_NAME, CPACK_PACKAGE_VERSION and CPACK_SYSTEM_NAME
are not defined YET.
In fact they will  be defined AFTER include(CPack).

> Am I doing something wrong? (I want to add a couple more variables in the
> CPACK_PACKAGE_FILE_NAME variable to specify compiler and compiler version,
> that's why I'm composing CPACK_PACKAGE_FILE_NAME)

You should either:

1) not rely on CPACK_xxx variable before include(CPack) and craft the value
    of CPACK_PACKAGE_FILE_NAME entirely.

or

2) use a CPACK_PROJECT_CONFIG_FILE and re-define
CPACK_PACKAGE_FILE_NAME in there.
    The CPack project file is loaded at CPack time so that all "usual"
CPack variables will
    be defined and usable.


--
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Empty CPack variables

Andreas Pakulat-2
In reply to this post by Pau Garcia i Quiles
Hi,

On Sun, Oct 6, 2013 at 10:13 PM, Pau Garcia i Quiles <[hidden email]> wrote:
Hello,

I am using CMake 2.8.11.2 on Windows to build and package some software. If I do this, it works fine:

   set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Wt binary build")
   set(CPACK_PACKAGE_VENDOR "emweb bvba")
   set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
   set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
   set(CPACK_PACKAGE_VERSION_MAJOR "3")
   set(CPACK_PACKAGE_VERSION_MINOR "3")
   set(CPACK_PACKAGE_VERSION_PATCH "1")
   set(CPACK_PACKAGE_INSTALL_DIRECTORY "Wt ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
   set(CPACK_GENERATOR "ZIP;NSIS")
   include(CPack)

But if I add this line before include(CPack):

  set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")

then CPACK_PACKAGE_NAME, CPACK_PACKAGE_VERSION and CPACK_SYSTEM_NAME are empty and the file is generated as "---.zip" / "---.exe". Am I doing something wrong? (I want to add a couple more variables in the CPACK_PACKAGE_FILE_NAME variable to specify compiler and compiler version, that's why I'm composing CPACK_PACKAGE_FILE_NAME)

I ran into this myself. IIRC the docs are not that clear on this, but the CPACK_* variables are only set inside the CPackConfig file, i.e. they are empty before your include(CPack). Thats the reason you end up with an empty name.

However the docs on the CPACK_* variables are rather clear on where they get their default value from if they're not set, so you should be able to look that up and replace CPACK_* with whatever they use as default (for example CMAKE_SYSTEM_NAME instead of CPACK_SYSTEM_NAME).

What I ended up to include the bitness is to set CPACK_SYSTEM_NAME myself and let the defaults of the rest be filled in, I'm using CMAKE_SYSTEM_NAME and simply append the 32/64 value with an additional variable. I'd probably do the same if I needed to have 'msvcXY' in the final package name (or something similar).

Andreas

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake