Skip to content
Snippets Groups Projects
Commit baffc2e2 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #10913: Add DESTINATION parameter to lofar_add_sysconf_files macro to...

Task #10913: Add DESTINATION parameter to lofar_add_sysconf_files macro to allow divergence between source and install tree structure
parent b99ece8d
No related branches found
No related tags found
No related merge requests found
...@@ -178,22 +178,39 @@ if(NOT DEFINED LOFAR_MACROS_INCLUDED) ...@@ -178,22 +178,39 @@ if(NOT DEFINED LOFAR_MACROS_INCLUDED)
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# lofar_add_sysconf_files([name1 [name2 ..]]) # lofar_add_sysconf_files([name1 [name2 ..]] [DESTINATION subdir])
# #
# Add system configuration files (read-only single machine data) that need # Add system configuration files (read-only single machine data) that need
# to be installed into the <prefix>/etc directory. Also create a symbolic # to be installed into the <prefix>/etc directory. Also create a symbolic
# link in <build-dir>/etc to each of these files. The file names may contain # link in <build-dir>/etc to each of these files. The file names may contain
# a relative(!) path. # a relative(!) path.
#
# The mentioned files are installed in the same relative path as provided,
# that is:
# lofar_add_sysconf_files(foo/bar)
# installs "etc/foo/bar". To override this behaviour use:
# lofar_add_sysconf_files(foo/bar DESTINATION .)
# installs "etc/bar".
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
macro(lofar_add_sysconf_files) macro(lofar_add_sysconf_files)
foreach(_name ${ARGN}) string(REGEX REPLACE ";?DESTINATION.*" "" _srcs "${ARGN}")
get_filename_component(_path ${_name} PATH) string(REGEX MATCH "DESTINATION;.*" _dest "${ARGN}")
get_filename_component(_abs_name ${_name} ABSOLUTE) string(REGEX REPLACE "^DESTINATION;" "" _dest "${_dest}")
foreach(_src_name ${_srcs})
if(_dest MATCHES ".+")
get_filename_component(_dst_name ${_src_name} NAME)
else(_dest MATCHES ".+")
set(_dst_name ${_src_name})
endif(_dest MATCHES ".+")
get_filename_component(_abs_name ${_src_name} ABSOLUTE)
get_filename_component(_dst_path ${_dst_name} PATH)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/etc/${_path}) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/etc/${_path})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${_abs_name} ${CMAKE_BINARY_DIR}/etc/${_name}) ${_abs_name} ${CMAKE_BINARY_DIR}/etc/${_dst_name})
install(FILES ${_name} DESTINATION etc/${_path}) install(FILES ${_src_name} DESTINATION etc/${_dst_path})
endforeach(_name ${ARGN}) endforeach(_src_name ${ARGN})
endmacro(lofar_add_sysconf_files) endmacro(lofar_add_sysconf_files)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment