https://fedoraproject.org/wiki/Packaging:Cmake
%build mkdir build pushd build # or: mkdir -p %{_target_platform} ; pushd %{_target_platform} %cmake .. popd %make_build -C build # or: make %{?_smp_mflags} -C build %install %make_install -C build # or: make install DESTDIR=%{buildroot} %check # in case there are tests, build and execute them pushd build ctest -VV %{?_smp_mflags} popd
%prep # unpack tarball etc... # drop rpath, https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath find . -name CMakeLists.txt |xargs sed -i /INSTALL_RPATH/d
¹ https://github.com/mhogomchungu/zuluCrypt/blob/77a698e817fd8df7b832171b4dc7131e9f93c85e/zuluCrypt-gui/CMakeLists.txt#L97
² https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath
³ https://fedoraproject.org/wiki/Packaging:Guidelines#Removing_Rpath
4 https://fedoraproject.org/wiki/Packaging:Guidelines#Application_Specific_Guidelines
Ad 1.:
%build mkdir build pushd build # or: mkdir -p %{_target_platform} ; pushd %{_target_platform} %cmake .. popd %make_build -C build # or: make %{?_smp_mflags} -C build %install %make_install -C build # or: make install DESTDIR=%{buildroot} -C build %check # in case there are tests, build and execute them pushd build ctest -VV %{?_smp_mflags} popd `
Ad 2.:
%prep # unpack tarball etc... # drop rpath, https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath find . -name CMakeLists.txt |xargs sed -i /INSTALL_RPATH/d
find . -name CMakeLists.txt |xargs sed -i /INSTALL_RPATH/d
This is wrong. Not all uses of INSTALL_RPATH are either wrong (e.g., usage in something like if (CMAKE_SKIP_INSTALL_RPATH) would have this create unparseable CMake files) and not all of them are guaranteed to occur in a CMakeLists.txt file (e.g., a function defined in some utility .cmake file that is included). Instead, the wiki currently suggests setting -DCMAKE_SKIP_INSTALL_RPATH=ON which causes CMake to ignore any INSTALL_RPATH property setting on a target.
INSTALL_RPATH
if (CMAKE_SKIP_INSTALL_RPATH)
CMakeLists.txt
.cmake
-DCMAKE_SKIP_INSTALL_RPATH=ON
We discussed this at this weeks meeting (http://meetbot.fedoraproject.org/fedora-meeting-1/2016-08-11/fpc.2016-08-11-16.00.txt):
Replying to [comment:4 james]:
ACTION: Out-of-src-tree suggestion won't work for all packages.
On Cygwin, we generally build packages in a dedicated build directory, and among my ~700 packages which use cmake, a quick check showed only three which needed to be fixed therefor:
https://github.com/cygwinports/ibus-chewing/blob/master/1.4.2-vpath.patch https://github.com/cygwinports-extras/cmake-fedora/blob/master/1.0.5-vpath.patch https://github.com/cygwinports-extras/qxkb/blob/master/0.4.6-vpath.patch
So overall I don't think this should be a major problem.
Metadata Update from @yselkowitz: - Issue assigned to james
Metadata Update from @tibbs: - Issue close_status updated to: None - Issue tagged with: draftneeded
Metadata Update from @ignatenkobrain: - Issue tagged with: cmake
Log in to comment on this ticket.