Skip to content
Snippets Groups Projects
Commit b8f6e0b7 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-164: made macro lofar_add_data_files behave equal to...

SW-164: made macro lofar_add_data_files behave equal to lofar_add_sysconf_files: now you can added a (relative) destination
parent 265e78bf
No related branches found
No related tags found
1 merge request!87Lsmr epic
......@@ -240,19 +240,37 @@ if(NOT DEFINED LOFAR_MACROS_INCLUDED)
# installed into the <prefix>/share directory. Also create a symbolic link
# in <build-dir>/share to each of these files. The file names may contain
# a relative(!) path.
#
# The mentioned files are installed in the same relative path as provided,
# that is:
# lofar_add_data_files(foo/bar)
# installs "share/foo/bar". To override this behaviour use:
# lofar_add_data_files(foo/bar DESTINATION .)
# installs "share/bar".
# --------------------------------------------------------------------------
macro(lofar_add_data_files)
string(REGEX REPLACE ";?DESTINATION.*" "" _src_names "${ARGN}")
string(REGEX MATCH "DESTINATION;.*" _destination "${ARGN}")
string(REGEX REPLACE "^DESTINATION;" "" _destination "${_destination}")
string(TOLOWER ${PACKAGE_NAME} lower_package_name)
foreach(_name ${ARGN})
get_filename_component(_path ${_name} PATH)
get_filename_component(_abs_name ${_name} ABSOLUTE)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/${_path})
foreach(_src_name ${_src_names})
if(_destination MATCHES ".+")
get_filename_component(_src_filename ${_src_name} NAME)
set(_dest_name ${_destination}/${_src_filename})
else(_destination MATCHES ".+")
set(_dest_name ${_src_name})
endif(_destination MATCHES ".+")
get_filename_component(_abs_name ${_src_name} ABSOLUTE)
get_filename_component(_dest_path ${_dest_name} PATH)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/${_dest_path})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${_abs_name} ${CMAKE_BINARY_DIR}/share/${_name})
install(FILES ${_name}
DESTINATION share/${_path}
${_abs_name} ${CMAKE_BINARY_DIR}/share/${_dest_name})
install(FILES ${_src_name}
DESTINATION share/${_dest_path}
COMPONENT ${lower_package_name})
endforeach(_name ${ARGN})
endforeach(_src_name ${_src_names})
endmacro(lofar_add_data_files)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment