build: Add cmake fns to symlink and install local libs

The code needed to do this (inline) is ugly and verbose
This commit is contained in:
John Colvin committed 2024-09-18 14:02:39 +00:00
1 parent 3afc447538
commit 2e7478629f
1 file changed
+22
+22
View File
@@ -18,6 +18,28 @@ function(sym_link_dir)
)
endfunction()
function(sym_link_file)
set(_options)
set(_one_value_args TARGET_NAME SOURCE DEST INSTALL_DEST)
set(_multi_value_args)
cmake_parse_arguments(_ARGS "${_options}" "${_one_value_args}" "${_multi_value_args}" ${ARGN})
add_custom_command(
OUTPUT ${_ARGS_DEST}
COMMAND ln ARGS -s ${_ARGS_SOURCE} ${_ARGS_DEST}
)
add_custom_target(
${_ARGS_TARGET_NAME} ALL
DEPENDS ${_ARGS_DEST}
)
if (DEFINED _ARGS_INSTALL_DEST)
install(
FILES
${_ARGS_SOURCE}
DESTINATION ${_ARGS_INSTALL_DEST}
)
endif()
endfunction()
function(sym_link_local_lib LIB_NAME)
set(_lib_file_name "${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.so")
file(