Environment:
OS: Windows 11
Build environment: MSYS2 (UCRT64)
CMake toolchain: Ninja, Qt6
Bug Description:
When attempting to configure and generate the build files using CMake, the process fails at the very end (Generation step) with the following error:
CMake Error at cmake/CopyToBuildDir.cmake:62 (add_custom_target):
Error evaluating generator expression:
$<TARGET_FILE_DIR:scantailor>
No target "scantailor"
Call Stack (most recent call first):
CMakeLists.txt:457 (generate_copy_to_build_dir_target)
Root Cause:
The bug occurs because the main executable is defined with the name scantailor-advanced in src/app/CMakeLists.txt (via set(target_name scantailor-advanced)), but several CMake scripts are still using the hardcoded old name scantailor.
Since the target scantailor does not exist, the generator expression fails, breaking the build—especially on Windows where CopyToBuildDir.cmake is used to deploy DLLs. It also breaks the translation targets in the root CMakeLists.txt.
Proposed Solution:
The hardcoded strings need to be updated to match the new target name. Replacing scantailor with scantailor-advanced (or using the ${target_name} variable if applicable) in the following files fixes the build entirely:
-
In cmake/CopyToBuildDir.cmake (around line 62):
Change:
$<TARGET_FILE_DIR:scantailor>
To:
$<TARGET_FILE_DIR:scantailor-advanced>
-
In root CMakeLists.txt (around lines 334-335):
Change:
finalize_translations(scantailor ${translation_files})
update_translations_target(update_translations scantailor)
To:
finalize_translations(scantailor-advanced ${translation_files})
update_translations_target(update_translations scantailor-advanced)
Applying these changes allows CMake to successfully evaluate the target and package the executable with windeployqt successfully under Qt6.
Environment:
OS: Windows 11
Build environment: MSYS2 (UCRT64)
CMake toolchain: Ninja, Qt6
Bug Description:
When attempting to configure and generate the build files using CMake, the process fails at the very end (Generation step) with the following error:
Root Cause:
The bug occurs because the main executable is defined with the name scantailor-advanced in src/app/CMakeLists.txt (via set(target_name scantailor-advanced)), but several CMake scripts are still using the hardcoded old name scantailor.
Since the target scantailor does not exist, the generator expression fails, breaking the build—especially on Windows where CopyToBuildDir.cmake is used to deploy DLLs. It also breaks the translation targets in the root CMakeLists.txt.
Proposed Solution:
The hardcoded strings need to be updated to match the new target name. Replacing scantailor with scantailor-advanced (or using the ${target_name} variable if applicable) in the following files fixes the build entirely:
In cmake/CopyToBuildDir.cmake (around line 62):
Change:
$<TARGET_FILE_DIR:scantailor>
To:
$<TARGET_FILE_DIR:scantailor-advanced>
In root CMakeLists.txt (around lines 334-335):
Change:
finalize_translations(scantailor ${translation_files})
update_translations_target(update_translations scantailor)
To:
finalize_translations(scantailor-advanced ${translation_files})
update_translations_target(update_translations scantailor-advanced)
Applying these changes allows CMake to successfully evaluate the target and package the executable with windeployqt successfully under Qt6.