qt5base-lts/cmake/QtPrecompiledHeadersHelpers.cmake
Alexandru Croitor 44cce1a2ea CMake: Split QtBuild.cmake into smaller files
QtBuild.cmake is huge. Split it.

Move module, plugin, tools, executables and test related functions out
of QtBuild.cmake into separate files.
Do the same for many other things too.

An additional requirement is that all the new Helpers files only
define functions and macros.
No global variable definitions are allowed, nor execution of commands
with side effects.

Some notes:
qt_install_qml_files is removed because it's dead code.

Some functions still need to be figured out, because they are
interspersed and depend on various global state assignments.

Task-number: QTBUG-86035
Change-Id: I21d79ff02eef923c202eb1000422888727cb0e2c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-14 13:17:11 +02:00

30 lines
1.1 KiB
CMake

function(qt_update_precompiled_header target precompiled_header)
if (precompiled_header AND BUILD_WITH_PCH)
set_property(TARGET "${target}" APPEND PROPERTY "PRECOMPILE_HEADERS" "$<$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:OBJCXX>>:${precompiled_header}>")
endif()
endfunction()
function(qt_update_precompiled_header_with_library target library)
if (TARGET "${library}")
get_target_property(TARGET_TYPE "${library}" TYPE)
if (NOT TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
get_target_property(HEADER "${library}" MODULE_HEADER)
qt_update_precompiled_header("${target}" "${HEADER}")
endif()
endif()
endfunction()
function(qt_update_ignore_pch_source target sources)
if (sources)
set_source_files_properties(${sources} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
endfunction()
function(qt_ignore_pch_obj_c_sources target sources)
# No obj-cxx PCH support for versions lower than 3.16.
if(CMAKE_VERSION VERSION_LESS 3.16.0)
list(FILTER sources INCLUDE REGEX "\\.mm$")
qt_update_ignore_pch_source("${target}" "${sources}")
endif()
endfunction()