[CMAKE] make package works but ninja package does not

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

[CMAKE] make package works but ninja package does not

Alfred Sawaya
Hello folks,

I ran into an issue today and I think it is an unexpected behaviour.

I have a CMake project that build an external project (autotools) and pack it into a .deb.
It works when I use the Makefile generator (cmake /my/path) but it does not when I use the Ninja generator (cmake -G Ninja /my/path) -> it produces an valid but empty package.

I expected that the behaviour would be the same regardless the generator I use. Is that correct ?

Here is the complete CMakeLists.txt : 

project(sqlcipher)
cmake_minimum_required (VERSION 2.8)
include(ExternalProject)

ExternalProject_Add(
    lsqlcipher
    BUILD_IN_SOURCE true
    CONFIGURE_COMMAND ./configure --enable-tempstore=yes "CFLAGS=-DSQLITE_HAS_CODEC"
)

SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libssl1.0.2,libssl-dev")
SET(CPACK_DEBIAN_PACKAGE_PROVIDES "libqlcipher0, libsqlcipher-dev, sqlcipher")
SET(CPACK_DEBIAN_PACKAGE_REPLACES ${CPACK_DEBIAN_PACKAGE_PROVIDES})
SET(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_NAME "my-sqlcipher")
SET(CPACK_PACKAGE_VERSION "3.20.1")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Me")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Install the last version of sqlcipher")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "all")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
INCLUDE(CPack)

To reproduce : 
  1. Copy the CMakeLists.txt content to a file
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make package
  6. dpkg -c *.deb # => there is contents
  7. rm -rf *
  8. cmake -G Ninja ..
  9. ninja package
  10. dpkg -c *.deb # => it is empty...
Any idea of what I am doing wrong ? Or is it a bug in CMake/CPack ?

Thank you,

Alfred
--
Cordialement,
Alfred Sawaya

--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: [CMAKE] make package works but ninja package does not

Alfred Sawaya
The only difference is about the usage of preinstall target. The Ninja generator does not use it, and it should because it need to build sqlcipher before packaging it...

the interesting part of vimdiff of cpack --trace : 

        Unix Makefiles                                   |               Ninja
  CPack: Install projects                              |  CPack: Install projects
  ---------------------------------------------- --------|  CPack: - Run preinstall target for: sqlcipher    
  CPack: - Install project: sqlcipher             |  CPack: - Install project: sqlcipher

Regards,

Le mer. 25 avr. 2018 à 13:03, Alfred Sawaya <[hidden email]> a écrit :
Hello folks,

I ran into an issue today and I think it is an unexpected behaviour.

I have a CMake project that build an external project (autotools) and pack it into a .deb.
It works when I use the Makefile generator (cmake /my/path) but it does not when I use the Ninja generator (cmake -G Ninja /my/path) -> it produces an valid but empty package.

I expected that the behaviour would be the same regardless the generator I use. Is that correct ?

Here is the complete CMakeLists.txt : 

project(sqlcipher)
cmake_minimum_required (VERSION 2.8)
include(ExternalProject)

ExternalProject_Add(
    lsqlcipher
    BUILD_IN_SOURCE true
    CONFIGURE_COMMAND ./configure --enable-tempstore=yes "CFLAGS=-DSQLITE_HAS_CODEC"
)

SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libssl1.0.2,libssl-dev")
SET(CPACK_DEBIAN_PACKAGE_PROVIDES "libqlcipher0, libsqlcipher-dev, sqlcipher")
SET(CPACK_DEBIAN_PACKAGE_REPLACES ${CPACK_DEBIAN_PACKAGE_PROVIDES})
SET(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_NAME "my-sqlcipher")
SET(CPACK_PACKAGE_VERSION "3.20.1")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Me")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Install the last version of sqlcipher")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "all")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
INCLUDE(CPack)

To reproduce : 
  1. Copy the CMakeLists.txt content to a file
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make package
  6. dpkg -c *.deb # => there is contents
  7. rm -rf *
  8. cmake -G Ninja ..
  9. ninja package
  10. dpkg -c *.deb # => it is empty...
Any idea of what I am doing wrong ? Or is it a bug in CMake/CPack ?

Thank you,

Alfred
--
Cordialement,
Alfred Sawaya
--
Cordialement,
Alfred Sawaya

--

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:
https://cmake.org/mailman/listinfo/cmake