What is the CMake equivalent for autotools "make dist" ?

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

What is the CMake equivalent for autotools "make dist" ?

houssen
Hello,

What is the CMake equivalent for autotools "make dist" ?
By autotools "make dist", I mean a way to wrap all sources and test
files needed to build and test the package and / or to be ready for dev.

I googled this question : I heard about CPack (and "make package"),
but, I am not sure to understand if this is designed to answer the same
question.
Using CPack and "make package", I get a tar.gz that contains the
executable (the binary in a bin directory) but without the source : this
is not what I want as sources are missing (the tar.gz is not ready for
dev).

Is this the expected behavior ? ("make package" is intended to provide
only binaries to be installed ? Not the source / test files ?)
Did I miss something ? Did I forgot something in the CMakeLists.txt ?
I am supposed to tar the root directory (= project directory containing
hello.cpp and CMakeLists.txt) after I suppressed all BUILD directories
that could have been built previously ?

FH
--

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://public.kitware.com/mailman/listinfo/cmake

CMakeLists.txt (298 bytes) Download Attachment
hello.cpp (192 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: What is the CMake equivalent for autotools "make dist" ?

Iosif Neitzke
With CPack enabled, "make help" will show all the valid targets.  The
"package_source" target should be one of those targets.

A simple project on Linux built with "make package_source" gives me:

${CMAKE_BINARY_DIR}/_CPack_Packages/Linux-Source/{TZ,TGZ,TBZ2}/CPack_Example-0.1.1-Linux.tar.{bz2,gz,Z}

All three files contain all the source files in my
${CMAKE_SOURCE_DIR}.  (Including CMakeLists.txt)



On Sat, Oct 11, 2014 at 12:05 PM, houssen <[hidden email]> wrote:

> Hello,
>
> What is the CMake equivalent for autotools "make dist" ?
> By autotools "make dist", I mean a way to wrap all sources and test files
> needed to build and test the package and / or to be ready for dev.
>
> I googled this question : I heard about CPack (and "make package"), but, I
> am not sure to understand if this is designed to answer the same question.
> Using CPack and "make package", I get a tar.gz that contains the executable
> (the binary in a bin directory) but without the source : this is not what I
> want as sources are missing (the tar.gz is not ready for dev).
>
> Is this the expected behavior ? ("make package" is intended to provide only
> binaries to be installed ? Not the source / test files ?)
> Did I miss something ? Did I forgot something in the CMakeLists.txt ?
> I am supposed to tar the root directory (= project directory containing
> hello.cpp and CMakeLists.txt) after I suppressed all BUILD directories that
> could have been built previously ?
>
> FH
> --
>
> 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://public.kitware.com/mailman/listinfo/cmake
--

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

Re: What is the CMake equivalent for autotools "make dist" ?

houssen
Thanks, "make package_source" is what I need.

FH

Le 2014-10-11 20:03, Iosif Neitzke a écrit :

> With CPack enabled, "make help" will show all the valid targets.  The
> "package_source" target should be one of those targets.
>
> A simple project on Linux built with "make package_source" gives me:
>
>
> ${CMAKE_BINARY_DIR}/_CPack_Packages/Linux-Source/{TZ,TGZ,TBZ2}/CPack_Example-0.1.1-Linux.tar.{bz2,gz,Z}
>
> All three files contain all the source files in my
> ${CMAKE_SOURCE_DIR}.  (Including CMakeLists.txt)
>
>
>
> On Sat, Oct 11, 2014 at 12:05 PM, houssen <[hidden email]> wrote:
>> Hello,
>>
>> What is the CMake equivalent for autotools "make dist" ?
>> By autotools "make dist", I mean a way to wrap all sources and test
>> files
>> needed to build and test the package and / or to be ready for dev.
>>
>> I googled this question : I heard about CPack (and "make package"),
>> but, I
>> am not sure to understand if this is designed to answer the same
>> question.
>> Using CPack and "make package", I get a tar.gz that contains the
>> executable
>> (the binary in a bin directory) but without the source : this is not
>> what I
>> want as sources are missing (the tar.gz is not ready for dev).
>>
>> Is this the expected behavior ? ("make package" is intended to
>> provide only
>> binaries to be installed ? Not the source / test files ?)
>> Did I miss something ? Did I forgot something in the CMakeLists.txt
>> ?
>> I am supposed to tar the root directory (= project directory
>> containing
>> hello.cpp and CMakeLists.txt) after I suppressed all BUILD
>> directories that
>> could have been built previously ?
>>
>> FH
>> --
>>
>> 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://public.kitware.com/mailman/listinfo/cmake

--

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

Re: What is the CMake equivalent for autotools "make dist" ?

Jörg Kreuzberger
In reply to this post by houssen
Hi!

This was also new to me, quite good. Question is now: i have configured cpack in my CMakeLists to use TGZ only (on linux).
The binary package is made as tgz. For the source 3 packages are generated (as in your example). How could this be
limited to the same as for the binaries or a different but just one?
With my sources it takes some time to package...


>Subject: Re: [CMake] What is the CMake equivalent for autotools "make
> dist" ?
>
>With CPack enabled, "make help" will show all the valid targets.  The
>"package_source" target should be one of those targets.
>
>A simple project on Linux built with "make package_source" gives me:
>
>${CMAKE_BINARY_DIR}/_CPack_Packages/Linux-Source/{TZ,TGZ,TBZ2}/CPack_Example-0.1.1-Linux.tar.{bz2,gz,Z}
>
>All three files contain all the source files in my
>${CMAKE_SOURCE_DIR}.  (Including CMakeLists.txt)

Mannheim HRB 504702
Geschäftsführer: Dipl.-Ing. (FH) Michael Brenk (Vorsitzender), Dipl.-Ing. (FH) Dipl.-Inf. (FH) Jens Heyen

This e-mail may contain confidential and/or legally protected information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this email is strictly forbidden.
Thank you!


--

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

Re: What is the CMake equivalent for autotools "make dist" ?

Jörg Kreuzberger
In reply to this post by houssen
Ok, found it: i must set CPACK_SOURCE_TZ to off to avoid the source to be packaged as tz.
its a little bit different as for the binary package, but ok.

Thanks

Joerg

>Hi!
>
>This was also new to me, quite good. Question is now: i have configured cpack in my CMakeLists to use TGZ only (on >linux).
>The binary package is made as tgz. For the source 3 packages are generated (as in your example). How could this be
>limited to the same as for the binaries or a different but just one?
>With my sources it takes some time to package...
>
>
>>Subject: Re: [CMake] What is the CMake equivalent for autotools "make
>> dist" ?
>>
>>With CPack enabled, "make help" will show all the valid targets.  The
>>"package_source" target should be one of those targets.
>>
>>A simple project on Linux built with "make package_source" gives me:
>>
>>${CMAKE_BINARY_DIR}/_CPack_Packages/Linux-Source/{TZ,TGZ,TBZ2}/CPack_Example-0.1.1-Linux.tar.{bz2,gz,Z}
>>
>>All three files contain all the source files in my
>>${CMAKE_SOURCE_DIR}.  (Including CMakeLists.txt)

Mannheim HRB 504702
Geschäftsführer: Dipl.-Ing. (FH) Michael Brenk (Vorsitzender), Dipl.-Ing. (FH) Dipl.-Inf. (FH) Jens Heyen

This e-mail may contain confidential and/or legally protected information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this email is strictly forbidden.
Thank you!


--

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

Re: What is the CMake equivalent for autotools "make dist" ?

Eric Noulard
In reply to this post by Jörg Kreuzberger


2014-10-14 9:21 GMT+02:00 Jörg Kreuzberger <[hidden email]>:
Hi!

This was also new to me, quite good. Question is now: i have configured cpack in my CMakeLists to use TGZ only (on linux).
The binary package is made as tgz. For the source 3 packages are generated (as in your example). How could this be
limited to the same as for the binaries or a different but just one?
With my sources it takes some time to package...

The way to select the list of CPack generator to be used is the same for BINARY or SOURCE.

set(CPACK_GENERATOR "TGZ")
select TGZ for BINARY

set(CPACK_SOURCE_GENERATOR "TGZ")
does the same for SOURCE.

the default value of CPACK_SOURCE_GENERATOR is "TZ;TGZ;TBZ2"  (On unix).


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

Re: What is the CMake equivalent for autotools "make dist" ?

Eric Noulard
In reply to this post by Jörg Kreuzberger


2014-10-14 9:24 GMT+02:00 Jörg Kreuzberger <[hidden email]>:
Ok, found it: i must set CPACK_SOURCE_TZ to off to avoid the source to be packaged as tz.
its a little bit different as for the binary package, but ok.

This is a another way to select CPack generator but you can always specify the list explicitely
in your CMakeLists.txt **before** include(CPack).

You may have some "logic" depending on the target platform e.g;

if(WIN32)
    set(CPACK_SOURCE_GENERATOR "ZIP")
    set(CPACK_GENERATOR "ZIP")

    # Add NSIS generator iff makensis is found on the system
    find_program(MAKENSIS_EXECUTABLE
                 NAMES makensis
                 DOC "The NSIS package maker command")
    if (MAKENSIS_EXECUTABLE)
      list(APPEND CPACK_GENERATOR "NSIS")
    endif(MAKENSIS_EXECUTABLE)
else(WIN32)
    set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
    if(APPLE)
      set(CPACK_GENERATOR "TGZ;PackageMaker")
    else(APPLE)
      set(CPACK_GENERATOR "TGZ;RPM;DEB")
    endif(APPLE)
endif(WIN32)

include(CPack)


With this if you are in the build directory
make package (or in a generator independent way "cmake --build . --target package")
or
make package_source

will build the list of specified CPack generators packages.

However you can always override that by doing (in the build dir as well):
cpack -G TGZ

which will only build the binary TGZ whatever was specified in the CMakeLists.txt.

for the source package this is done using the CPackSourceConfig.cmake file:

cpack -G TGZ --config CPackSourceConfig.cmake

I hope this helps in understanding the way CPack works.


--
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://public.kitware.com/mailman/listinfo/cmake