31518f1a4e
- The following commands accepts NO_UNITY_BUILD, and NO_UNITY_BUILD_SOURCES arguments to opt out of the unity build, and to exclude some source files from unity build, respectively. - qt_internal_add_executable - qt_internal_add_module - qt_internal_add_plugin - qt_internal_add_tool - qt_internal_extend_target - qt_internal_add_common_qt_library_helper - qt_internal_add_cmake_library - qt_internal_add_simd_part - Unity build is disabled by default in these: - qt_internal_add_test - qt_internal_add_test_helper - qt_internal_add_benchmark - qt_internal_add_3rdparty_library - qt_update_ignore_pch_source also excludes the files from unity_build Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I5d0e7df633738310a015142a6c73fbb78b6c3467 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
35 lines
1.3 KiB
CMake
35 lines
1.3 KiB
CMake
# Copyright (C) 2022 The Qt Company Ltd.
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
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
|
|
SKIP_UNITY_BUILD_INCLUSION 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()
|