[Fix] Correct path for each build configuration

Used the cmake generator expression to determine the full path to the target file.
Link: https://cmake.org/cmake/help/v3.0/manual/cmake-generator-expressions.7.html#informational-expressions
This commit is contained in:
Paulchen Panther 2020-07-06 18:53:30 +02:00 committed by GitHub
parent 6cf9dfaa68
commit 0f3da1ccc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,10 +173,8 @@ macro(DeployUnix TARGET)
endmacro()
macro(DeployWindows TARGET)
# TODO Find out what build type it is
set(TARGET_FILE ${CMAKE_BINARY_DIR}/bin/Release/${TARGET}.exe)
if(EXISTS ${TARGET_FILE})
message(STATUS "Collecting Dependencies for target file: ${TARGET_FILE}")
find_package(Qt5Core REQUIRED)
# Find the windeployqt binaries
@ -277,7 +275,7 @@ macro(DeployWindows TARGET)
# Run CMake after target was built
add_custom_command(
TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND}
COMMAND "${CMAKE_COMMAND}" "-DTARGET_FILE=$<TARGET_FILE:${TARGET}>"
ARGS ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
VERBATIM