[CMake] Generating multiple debian packages

Bruce Cartland bruce.cartland at pobox.com
Wed Aug 8 22:29:34 EDT 2012


Ok - not what I get on ubuntu LTS 10.4. Perhaps I need the latest version?
( I ran the original files with just the missing line (?) 
"install(CPack)" added).

$ cmake -version
cmake version 2.8.0
$ ls
$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: 
/home/DEVELOPER/ucdm7/Dev/shadowmintorig/build
$ cpack -G DEB
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: CPACK_MULTI
CPack: - Install project: CPACK_MULTI
CPack: Compress package
CPack: Finalize package
CPack: Package 
/home/DEVELOPER/ucdm7/Dev/shadowmintorig/build/Demo3-0.1.1-Linux.deb 
generated.
$ ls
CMakeCache.txt  cmake_install.cmake  _CPack_Packages          demo1  
Demo3-0.1.1-Linux.deb  Makefile
CMakeFiles      CPackConfig.cmake    CPackSourceConfig.cmake  demo2  
install_manifest.txt
$



On 9/08/2012 12:01 PM, Doug wrote:
> Hm, I would expect this to work:
>
> mkdir build
> cd build
> cmake ..
> cpack -G DEB
>
> ...but you'll find that cpack only supports one set of properties per
> package, not per COMPONENT, which means you cannot have different
> dependencies, descriptions, etc.
>
> Also, woops; didn't mean to take that off list, I'll respond there
> too; maybe one of those guys has some better ideas...
>
> ...and yeah, this was just a super quick sample for a stack overflow question.
> Should probably go back and clean it up~
>
> Checked; works for me:
>
> doug at shadowmint:~/junk/cmake-multi-install$ clear
> doug at shadowmint:~/junk/cmake-multi-install$ cd build/
> doug at shadowmint:~/junk/cmake-multi-install/build$ ls
> doug at shadowmint:~/junk/cmake-multi-install/build$ cmake ..
> -- The C compiler identification is GNU
> -- The CXX compiler identification is GNU
> -- Check for working C compiler: /usr/bin/gcc
> -- Check for working C compiler: /usr/bin/gcc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler: /usr/bin/c++
> -- Check for working CXX compiler: /usr/bin/c++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/doug/junk/cmake-multi-install/build
> doug at shadowmint:~/junk/cmake-multi-install/build$ cpack -G DEB
> CPack: Create package using DEB
> CPack: Install projects
> CPack: - Run preinstall target for: CPACK_MULTI
> CPack: - Install project: CPACK_MULTI
> CPack: -   Install component: DEMO1
> CPack: -   Install component: DEMO2
> CPack: Create package
> CPack: - package:
> /home/doug/junk/cmake-multi-install/build/Demo3-0.1.1-Linux-DEMO1.deb
> generated.
> CPack: - package:
> /home/doug/junk/cmake-multi-install/build/Demo3-0.1.1-Linux-DEMO2.deb
> generated.
> doug at shadowmint:~/junk/cmake-multi-install/build$ ls
> CMakeCache.txt     CPackSourceConfig.cmake      Makefile
> demo1                       install_manifest_DEMO2.txt
> CMakeFiles         Demo3-0.1.1-Linux-DEMO1.deb  _CPack_Packages      demo2
> CPackConfig.cmake  Demo3-0.1.1-Linux-DEMO2.deb  cmake_install.cmake
> install_manifest_DEMO1.txt
> doug at shadowmint:~/junk/cmake-multi-install/build$ dpkg --info
> Demo3-0.1.1-Linux-DEMO1.deb
>   new debian package, version 2.0.
>   size 1870 bytes: control archive= 369 bytes.
>       174 bytes,     9 lines      control
>       153 bytes,     3 lines      md5sums
>   Package: demo3-demo1
>   Version: 0.1.1
>   Section: devel
>   Priority: optional
>   Architecture: amd64
>   Installed-Size: 4
>   Maintainer: linderd at staff.iinet.net.au
>   Description: Demo package
>
> doug at shadowmint:~/junk/cmake-multi-install/build$
>
> ~
> Doug.
>
>
> On Thu, Aug 9, 2012 at 9:44 AM, Bruce Cartland<bruce.cartland at pobox.com>  wrote:
>> Thanks for the sample - makes it a lot easier to experiment.
>>
>> I've been playing around with it but can't get it to do what I want (or is
>> claimed). It always generates just one package 'Demo3-0.1.1-Linux.deb'.
>>
>> Perhaps I'm not using the command lines correctly?
>>
>> The command lines I've used are:
>>
>> cmake .
>> cmake --build . --target install
>> cmake --build . --target package # this generates the Demo3 package.
>>
>> There are only two CPACK files generated: CPackConfig.cmake and
>> CPackSourceConfig.cmake.
>>
>> cpack -C DEMO2 # this also generates the Demo3 package which is identical to
>> the above.
>>
>> (also played around with cmake . -DCOMPONENT=DEMO2 and other such
>> constructions - to no avail).
>>
>> I did the following mods to clarify things:
>>
>> CMakeLists.txt
>> - added set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}") # near the top - for
>> easier testing
>> - added set(CPACK_GENERATOR "DEB") # before include(CPack) - for easier
>> testing
>>
>> Demo1/CMakeLists.txt
>> - added include(CPack) # at the bottom - assume this is a typo (tried with
>> and without anyway)
>>
>> Demo2/CMakeLists.txt
>> - made the DESTINATION "tmp2/"
>> - changed the description to say "Demo 2 package"
>> (so I end up, in the package, with "usr/tmp/Window.h" and
>> "usr/tmp2/Window.h", etc)
>>
>> Now, in the CPackConfig.cmake file (of which there is only one - at the
>> root), attributes like ..DESCRIPTION_SUMMARY appear once with Demo3's
>> description. Clearly then, there needs to be a CPackConfig.cmake file for
>> each (?).
>>
>> Demo3-0.1.1-Linux.deb always contains usr/tmp and usr/tmp2.
>>
>> I think I'll have to resort to the technique another user outlined in 2008
>> http://www.cmake.org/pipermail/cmake/2008-April/020967.html.
>>
>> Perhaps I must be missing something fundamental - for which I'll feel stupid
>> later.
>>
>> thanks
>>
>>
>> On 9/08/2012 12:01 AM, Doug wrote:
>>
>> I put an example up here when i was messing around with it:
>> https://github.com/shadowmint/cmake-multi-install
>>
>> ~
>> Doug.
>>
>> On Aug 8, 2012 3:07 PM, "Bruce"<bruce.cartland at pobox.com>  wrote:
>>> Hi
>>>
>>> Got my shiny new cmake build system going for my project on windows,
>>> Ubuntu, and Mac.
>>>
>>> Despite a fair bit of research I'm still not sure how to generate 2
>>> separate debian packages from the same cmake files - say myapp.deb and
>>> myapp-dev.deb.
>>>
>>> I think what I want is somehow for it to write out another file in the
>>> same manner it writes out both CPackConfig.cmake and
>>> CPackSourceConfig.cmake. A CPackDevConfig.cmake?
>>>
>>> Appreciate it if someone can point me in the right direction.
>>>
>>> Ta
>>> --
>>> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120809/82e78109/attachment.htm>


More information about the CMake mailing list