[CMake] CPack: avoid creating unnecessary man dirs

Robert J. Hansen rjh at sixdemonbag.org
Sat Oct 29 12:14:26 EDT 2016


I'm migrating a project from Autotools to CMake.  So far it's been a
good experience save for installing manpages.

I'm using include(GNUInstallDirs) to help make the migration easier.  In
my manpage subdir I have the following CMakeLists.txt:

set(MAN_NAMES nsrlsvr.1 nsrlupdate.1)
add_custom_target(man ALL DEPENDS ${MAN_NAMES})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/nsrlsvr.1 DESTINATION
${CMAKE_INSTALL_MANDIR}/man1/)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/nsrlupdate.1 DESTINATION
${CMAKE_INSTALL_MANDIR}/man1/)

This seems to work just fine for a "make install", and it successfully
generates RPMs with a "make package".  However, those RPMs are
uninstallable on a Fedora system:

Error: Transaction check error:
  file /usr/share/man from install of nsrlsvr-1.6.1-1.x86_64 conflicts
with file from package filesystem-3.2-37.fc24.x86_64
  file /usr/share/man/man1 from install of nsrlsvr-1.6.1-1.x86_64
conflicts with file from package filesystem-3.2-37.fc24.x86_64

Apparently, CMake is trying to create dirs even if they already exist.
Is there any way to suppress this?  What's the best way to address this?

(The full source tree, along with all the CMakeLists.txt files, is
available at https://github.com/rjhansen/nsrlsvr/ )


More information about the CMake mailing list