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.
master
jp9000 2020-09-06 17:44:35 -07:00
parent da8192544b
commit dc3839ab74
1 changed files with 17 additions and 0 deletions

View File

@ -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}/$<CONFIGURATION>/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}")