Merge pull request #27808 from jamessan/gen_cflags-cleanup

Cleanup construction of command-lines for header generation
This commit is contained in:
James McCoy
2024-03-12 14:00:29 -04:00
committed by GitHub

View File

@@ -450,20 +450,27 @@ endif()
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
get_target_property(prop main_lib INTERFACE_COMPILE_DEFINITIONS) get_target_property(prop main_lib INTERFACE_COMPILE_DEFINITIONS)
foreach(gen_cdef ${prop}) if(NOT "${prop}" STREQUAL "prop-NOTFOUND")
if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS") foreach(gen_cdef ${prop})
list(APPEND gen_cflags "-D${gen_cdef}") if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS")
endif() list(APPEND gen_cflags "-D${gen_cdef}")
endforeach() endif()
endforeach()
endif()
get_directory_property(targets BUILDSYSTEM_TARGETS) get_directory_property(targets BUILDSYSTEM_TARGETS)
foreach(target ${targets}) foreach(target ${targets})
get_target_property(prop ${target} INTERFACE_INCLUDE_DIRECTORIES) get_target_property(prop ${target} INTERFACE_INCLUDE_DIRECTORIES)
foreach(gen_include ${prop}) if(NOT "${prop}" STREQUAL "prop-NOTFOUND")
list(APPEND gen_cflags "-I${gen_include}") message(STATUS "${target} props '${prop}'")
endforeach() foreach(gen_include ${prop})
list(APPEND gen_cflags "-I${gen_include}")
endforeach()
endif()
endforeach() endforeach()
list(REMOVE_DUPLICATES gen_cflags)
if(APPLE AND CMAKE_OSX_SYSROOT) if(APPLE AND CMAKE_OSX_SYSROOT)
list(APPEND gen_cflags "-isysroot" "${CMAKE_OSX_SYSROOT}") list(APPEND gen_cflags "-isysroot" "${CMAKE_OSX_SYSROOT}")
endif() endif()