"set" not working in "install(CODE...)"
I have
install (
CODE
"
set ($ENV{__TargetPath} \"test\")
message (\"--> __TargetPath $ENV{__TargetPath}\")
set (__TargetPath} \"test\")
message (\"--> __TargetPath ${__TargetPath}\")
file (READ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_Path __TargetPath)
message (\"--> ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_Path\")
message (\"--> __TargetPath ${__TargetPath}\")
execute_process(
COMMAND
${__windeployqt_Executable} ${targetExecutable} ${__TargetPath}
)
"
)
What I want to do is call windeployqt to deploy the Qt libraries on install. Unfortunately it is not possible to get the target executable name in a trivial way. For that reason I am trying a workaround but then I hit a wall. Neither "set" nor "file(READ)" set the variable inside of "install(CODE)".
This is the output I get:
--> __TargetPath
--> __TargetPath
--> X:/GitHub/SSHTools/__build-output/Ninja-MSVC-x64-Debug/Sources/SSHCopy/SSHCopy_Path
--> __TargetPath
Please specify the binary or folder.
Usage: C:/SDKs/Qt/5.12.0/msvc2017_64/bin/windeployqt.exe [options] [files]
Qt Deploy Tool 5.12.0
Edited by Zingam