[CMake] What is the CMake equivalent for autotools "make dist" ?
Eric Noulard
eric.noulard at gmail.com
Tue Oct 14 03:44:11 EDT 2014
2014-10-14 9:24 GMT+02:00 Jörg Kreuzberger <j.kreuzberger at procitec.de>:
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141014/16303f0d/attachment.html>
More information about the CMake
mailing list