forked from qt-creator/qt-creator
CMake BuildSystem: Fix visibility handling for PCH
Change-Id: Ib91f03cf4f13ddefe365cf1e59cc083d700f0672 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -288,6 +288,14 @@ endfunction()
|
||||
|
||||
function(enable_pch target)
|
||||
if (BUILD_WITH_PCH)
|
||||
# Skip PCH for targets that do not use the expected visibility settings:
|
||||
get_target_property(visibility_property "${target}" CXX_VISIBILITY_PRESET)
|
||||
get_target_property(inlines_property "${target}" VISIBILITY_INLINES_HIDDEN)
|
||||
|
||||
if (NOT visibility_property STREQUAL "hidden" OR NOT inlines_property)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if (NOT ${target_type} STREQUAL "OBJECT_LIBRARY")
|
||||
function(_recursively_collect_dependencies input_target)
|
||||
@@ -313,7 +321,9 @@ function(enable_pch target)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c)
|
||||
target_compile_definitions(${pch_target} PRIVATE ${DEFAULT_DEFINES})
|
||||
set_target_properties(${pch_target} PROPERTIES
|
||||
PRECOMPILE_HEADERS ${pch_file})
|
||||
PRECOMPILE_HEADERS ${pch_file}
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
VISIBILITY_INLINES_HIDDEN ON)
|
||||
target_link_libraries(${pch_target} PRIVATE ${pch_dependency})
|
||||
endif()
|
||||
endfunction()
|
||||
|
Reference in New Issue
Block a user