CMake Build: Ensure valid destinations for generated files

- Make the build system aware that empty_pch.c/.cpp are generated files
  to prevent invalid access from _add_pch_target.
- Force the creation of the translation output directory before copying
qm files into it.

Change-Id: Iaff5e5ebdbfec7e89a47d277d95f9dec760a5b6b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Knud Dollereder
2020-06-30 16:38:23 +02:00
parent ecd0f45ab6
commit 9a4e65cc73
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -349,6 +349,11 @@ function(enable_pch target)
file(GENERATE
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp
CONTENT "/*empty file*/")
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c
${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp
PROPERTIES GENERATED TRUE)
_add_pch_target(QtCreatorPchGui
"${PROJECT_SOURCE_DIR}/src/shared/qtcreator_gui_pch.h" Qt5::Widgets)
_add_pch_target(QtCreatorPchConsole
+2
View File
@@ -138,6 +138,8 @@ function(add_translation_targets file_prefix)
add_custom_target("${_arg_ALL_QM_TARGET}" ALL COMMENT "Generate .qm-files")
endif()
file(MAKE_DIRECTORY ${_arg_OUTPUT_DIRECTORY})
foreach(l IN ITEMS ${_arg_LANGUAGES})
set(_ts_file "${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}_${l}.ts")
set(_qm_file "${_arg_OUTPUT_DIRECTORY}/${file_prefix}_${l}.qm")