mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
CMake: When building metalib components, properly flag SYSTEM include dirs
This commit is contained in:
parent
5c166e6cdc
commit
dd5c411e88
@ -31,6 +31,12 @@ if(CMAKE_VERSION VERSION_LESS "3.12")
|
|||||||
set_property(TARGET "${target}" APPEND PROPERTY INCLUDE_DIRECTORIES "${include_directories}")
|
set_property(TARGET "${target}" APPEND PROPERTY INCLUDE_DIRECTORIES "${include_directories}")
|
||||||
set_property(TARGET "${target}" APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${include_directories}")
|
set_property(TARGET "${target}" APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${include_directories}")
|
||||||
|
|
||||||
|
# SYSTEM include directories should still be reported as SYSTEM, so
|
||||||
|
# that warnings from those includes are suppressed
|
||||||
|
set(sys_include_directories
|
||||||
|
"$<TARGET_PROPERTY:${library},INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>")
|
||||||
|
target_include_directories("${target}" SYSTEM PUBLIC "${sys_include_directories}")
|
||||||
|
|
||||||
# And for INTERFACE_COMPILE_DEFINITIONS as well
|
# And for INTERFACE_COMPILE_DEFINITIONS as well
|
||||||
set(compile_definitions "$<TARGET_PROPERTY:${library},INTERFACE_COMPILE_DEFINITIONS>")
|
set(compile_definitions "$<TARGET_PROPERTY:${library},INTERFACE_COMPILE_DEFINITIONS>")
|
||||||
set_property(TARGET "${target}" APPEND PROPERTY COMPILE_DEFINITIONS "${compile_definitions}")
|
set_property(TARGET "${target}" APPEND PROPERTY COMPILE_DEFINITIONS "${compile_definitions}")
|
||||||
|
@ -158,6 +158,18 @@ function(package_option name)
|
|||||||
# Create the INTERFACE library used to depend on this package.
|
# Create the INTERFACE library used to depend on this package.
|
||||||
add_library(PKG::${name} INTERFACE IMPORTED GLOBAL)
|
add_library(PKG::${name} INTERFACE IMPORTED GLOBAL)
|
||||||
|
|
||||||
|
# Explicitly record the package's include directories as system include
|
||||||
|
# directories. CMake does do this automatically for INTERFACE libraries, but
|
||||||
|
# it does it by discovering all transitive links first, then reading
|
||||||
|
# INTERFACE_INCLUDE_DIRECTORIES for those which are INTERFACE libraries. So,
|
||||||
|
# this would be broken for the metalib system (pre CMake 3.12) which doesn't
|
||||||
|
# "link" the object libraries.
|
||||||
|
if(CMAKE_VERSION VERSION_LESS "3.12")
|
||||||
|
set_target_properties(PKG::${name} PROPERTIES
|
||||||
|
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
|
||||||
|
"$<TARGET_PROPERTY:PKG::${name},INTERFACE_INCLUDE_DIRECTORIES>")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Create the option, and if it actually is enabled, populate the INTERFACE
|
# Create the option, and if it actually is enabled, populate the INTERFACE
|
||||||
# library created above
|
# library created above
|
||||||
option("HAVE_${name}" "${cache_string}" "${default}")
|
option("HAVE_${name}" "${cache_string}" "${default}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user