CMake Packaging Guidelines
You will generally make use of these in your specs:
Defines CFLAGS, LDFLAGS, etc. and calls
%__cmakewith appropriate parameters (
-DCMAKE_INSTALL_PREFIX:PATH=/usrand such). You can pass
-Doption=valueto this macro in order to set options for the buildsystem.
Builds the project (using
Installs the built project (using
Runs the tests that are defined with
add_test()in project (using
When packaging KDE software, you most likely would replace
%cmake_kf5 that defines multiple KDE-related variables (shipped in
It is rarely necessary (but permissible) to use or alter these:
The path to the cmake executable.
The path to the ctest executable.
Controls whether builds are done in-source (when defined) or out-of-source (when undefined). See the Defining source and build directories for more information.
Since Fedora 33,
With recent cmake-2.4, it should not be used.
This CMake version should handle RPATHs issues correctly (set them in build-dir, remove them during installation).
CMAKE_SKIP_RPATH for this version would avoid RPATHs in build-dir too.
This might link binaries against system-libraries (e.g. when a previous version of the package was installed) instead of the libraries which were created by the build.
Nevertheless, RPATH issues might arise when CMake was used improperly.
For example, installing a target with
INSTALL(FILES ... RENAME ...) will not strip rpaths;
in this case
INSTALL(TARGETS ...) must be used in combination with changing the
NOTE: CMake has good documentation in two places: