file(GET_RUNTIME_DEPENDENCIES)'s DIRECTORIES parameter doesn't handle lists
Hello,
I tried to use the file(GET_RUNTIME_DEPENDENCIES) function after target build with multiple search directories and I wasn't able to give directory list to the file command:
My original script is:
cmake_path(GET TARGET_EXE FILENAME target_name)
message("Soft link missing dlls of: ${target_name}")
file(GET_RUNTIME_DEPENDENCIES
RESOLVED_DEPENDENCIES_VAR res_deps
UNRESOLVED_DEPENDENCIES_VAR unresolveds
CONFLICTING_DEPENDENCIES_PREFIX conflictings
EXECUTABLES ${TARGET_EXE}
DIRECTORIES ${LINK_DIR}
POST_EXCLUDE_REGEXES "[Ss][Yy][Ss][Tt][Ee][Mm]32.*"
)
foreach(dll IN LISTS res_deps)
cmake_path(GET dll FILENAME dll_name)
if(NOT EXISTS ${TARGET_DIR}/${dll_name})
cmake_path(RELATIVE_PATH dll BASE_DIRECTORY ${TARGET_DIR})
string(REPLACE "/" "\\" dll_blackslash ${dll})
file(CREATE_LINK ${dll_blackslash} ${TARGET_DIR}/${dll_name} SYMBOLIC)
endif()
endforeach()
It just creates soft links to dll files. I called it with the next cmdline:
cmake -DTARGET_EXE=$PWD/my.exe -DLINK_DIR="$PWD/../../../bin;$PWD/../../../../../thirdparties/thirdparties/windows_runtime/bin" -DTARGET_DIR=$PWD -P link_missing_dlls.cmake
If I modify the script and split the directory list to two separated variables and I add both of them to DIRECTORIES parameter that worked.
cmake -DTARGET_EXE=$PWD/my.exe -DLINK_DIR="$PWD/../../../bin" -DTHIRDPARTY_DIR="$PWD/../../../../../thirdparties/thirdparties/windows_runtime/bin" -DTARGET_DIR=$PWD -P link_missing_dlls.cmake
and the file() calling is the next:
file(GET_RUNTIME_DEPENDENCIES
RESOLVED_DEPENDENCIES_VAR res_deps
UNRESOLVED_DEPENDENCIES_VAR unresolveds
CONFLICTING_DEPENDENCIES_PREFIX conflictings
EXECUTABLES ${TARGET_EXE}
DIRECTORIES ${LINK_DIR} ${THIRDPARTY_DIR}
POST_EXCLUDE_REGEXES "[Ss][Yy][Ss][Tt][Ee][Mm]32.*"
)
Do you have any idea, what I made wrong? Or is this a bug?
Thanks:
Antal Tatrai
Edited by Antal Tátrai