Just a simple test of using CMake CPack to package the project for distribution. This is of no use or concern for the casual builder. This test-app binary does really nothing. It is a test of package building and a source distribution zip.
This simple CPack Test is built using CMake as the configuration and generation of native build files.
-
cd build
-
cmake .. [-DCMAKE_INSTALL_PREFIX=/root/path/for/install] [-G "Generator of choice"]
-
make
-
[sudo] make install
-
cd build
-
cmake .. [-DCMAKE_INSTALL_PREFIX=/root/path/for/install] [-G "Generator of choice"]
-
cmake --build . --config Release
-
cmake --build . --config Release --target INSTALL
-
Load GUI
-
Set path to source
-
Set path to source/build folder
-
Choose/Set Generator of choice
-
Click [Configure]
Maybe needed more than once -
Click [Generation]
-
Load or run build tools
For example, if in Windows with MSVC installed, this last step would be to load the MSVC IDE, and load the test-cpack.sln file, and proceed with the building of various configurations.
This is the extra step to generate the distribution package
cmake --build . --config Release --target PACKAGE
In windows this should generate a test-cpack-3.0.0-win32.exe, using NSIS, if installed, and available, or a test-cpack-3.0.0-win32.msi, using WIX, if installed and available, for installing the exe, and the headers, or other dev components...
make package
In linux this shoudl generate a test-cpack-3.0.0-Linux.deb, for installing the binary, and the headers, or other dev components...
To generate the source archive, a zip in windows, and a tar.gz in linux -
cpack --config CPackSourceConfig.cmake
This should generate a source archive for distribution. Take care all backup files and other non-source files are removed before running this. All items is the .git and build directories are already ignored.
In Windows the CPack generators normally include -
- NSIS - (Nullsoft Scriptable Install System) - Generates an installer EXE - see nsis.sourceforge - needs to be installed.
- WIX - WiX Toolset - Generates an installer MSI - see wix.codeplex - needs to be installed and a PATH added to candle.exe
Both these generator need special variables set in the CMakeLists.txt file before including the CPack module.
;eof