zeek/cmake/InstallClobberImmune.cmake
Jon Siwek dec97ab56d Changes to the way user-modifiable config files are installed.
- Duplicates of the distribution's configuration files are now always
  installed with a .example suffix
- Added --binary-package configure option to toggle configure logic
  specific to the creation of binary packages.
- When not in binary packaging mode, `make install` never overwrites
  existing configure files in case they've been modified.  The previous
  behavior (CMake's default) would only avoid overwriting modified files
  if one consistently uses the same build directory and doesn't reconfigure.
- Fixed an issue with Mac package's pre-install script not preserving ACLs
- Minor cleanup/refactor of the make-mac/rpm-packages scripts
2011-02-24 22:02:22 -06:00

20 lines
796 B
CMake

# Determines at `make install` time if a file, typically a configuration
# file placed in $PREFIX/etc, shouldn't be installed to prevent overwrite
# of an existing file.
#
# _srcfile: the file to install
# _dstfile: the absolute file name after installation
macro(InstallClobberImmune _srcfile _dstfile)
install(CODE "
if (EXISTS ${_dstfile})
message(STATUS \"Skipping: ${_dstfile} (already exists)\")
else ()
message(STATUS \"Installing: ${_dstfile}\")
# install() is not scriptable within install(), and
# configure_file() is the next best thing
configure_file(${_srcfile} ${_dstfile} COPY_ONLY)
# TODO: create additional install_manifest files?
endif ()
")
endmacro(InstallClobberImmune)