From Fedora Project Wiki

(Might as well use %make_install as well.)
(Deprecate page.)
Line 1: Line 1:
= Guidelines for cmake =
= Guidelines for cmake =

Latest revision as of 03:38, 20 December 2018

This is an old copy of a packaging guideline, preserved here in the wiki while we complete the transition to the Fedora documentation system. The current version is located at Please update your bookmarks.

Guidelines for cmake

This document provides cmake best-practices for generating Fedora RPMS using cmake

RPM Macros

If cmake is installed, see /usr/lib/rpm/macros.d/cmake or /etc/rpm/macros.cmake on EL6.

If kde-filesystem is installed, see /usr/lib/rpm/macros.d/macros.kde4

Specfile Usage

%cmake .


ctest -V %{?_smp_mflags}


NOTE: -DCMAKE_SKIP_RPATH:BOOL=ON. 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). Setting 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. E.g. installing a target with INSTALL(FILES ... RENAME ...) will not strip rpaths; in this case INSTALL(TARGETS ...) must be used in combination with changing the OUTPUT_NAME property.

NOTE: cmake has good documentation in two places: