From dc3839ab74d44183d0f87b380c85e79aef72d8d8 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sun, 6 Sep 2020 17:44:35 -0700 Subject: [PATCH] cmake: Add function for installing data from abs path Allows the ability to install extra data from a specific absolute path rather than a path relative to the cmake current source dir. Useful if say I want to generate data files in to the cmake binary folder rather than put them in the data folder of the cmake source dir. --- cmake/Modules/ObsHelpers.cmake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmake/Modules/ObsHelpers.cmake b/cmake/Modules/ObsHelpers.cmake index cb63ba611..2119eb887 100644 --- a/cmake/Modules/ObsHelpers.cmake +++ b/cmake/Modules/ObsHelpers.cmake @@ -504,6 +504,23 @@ function(install_obs_data target datadir datadest) endif() endfunction() +function(install_obs_data_from_abs_path target datadir datadest) + install(DIRECTORY ${datadir}/ + DESTINATION "${OBS_DATA_DESTINATION}/${datadest}" + USE_SOURCE_PERMISSIONS) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory + "${datadir}" "${OBS_OUTPUT_DIR}/$/data/${datadest}" + VERBATIM) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND DEFINED ENV{obsInstallerTempDir}) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory + "${datadir}" "$ENV{obsInstallerTempDir}/${OBS_DATA_DESTINATION}/${datadest}" + VERBATIM) + endif() +endfunction() + function(install_obs_data_file target datafile datadest) install(FILES ${datafile} DESTINATION "${OBS_DATA_DESTINATION}/${datadest}")