mirror of
https://github.com/PCSX2/pcsx2.git
synced 2024-11-23 01:19:53 +00:00
CMake: Try to put /usr/local/include last
Some checks failed
🐧 Linux Builds / AppImage (push) Has been cancelled
🐧 Linux Builds / Flatpak (push) Has been cancelled
🍎 MacOS Builds / Defaults (push) Has been cancelled
🖥️ Windows Builds / Lint VS Project Files (push) Has been cancelled
🖥️ Windows Builds / CMake (push) Has been cancelled
🏭 Update Controller Database / update-controller-db (push) Has been cancelled
🖥️ Windows Builds / SSE4 (push) Has been cancelled
🖥️ Windows Builds / AVX2 (push) Has been cancelled
Some checks failed
🐧 Linux Builds / AppImage (push) Has been cancelled
🐧 Linux Builds / Flatpak (push) Has been cancelled
🍎 MacOS Builds / Defaults (push) Has been cancelled
🖥️ Windows Builds / Lint VS Project Files (push) Has been cancelled
🖥️ Windows Builds / CMake (push) Has been cancelled
🏭 Update Controller Database / update-controller-db (push) Has been cancelled
🖥️ Windows Builds / SSE4 (push) Has been cancelled
🖥️ Windows Builds / AVX2 (push) Has been cancelled
This commit is contained in:
parent
256a946f96
commit
9858aa1aa5
@ -287,3 +287,58 @@ int main() {
|
||||
set(HOST_CACHE_LINE_SIZE ${detect_cache_line_size_output} CACHE STRING "Reported host cache line size")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(get_recursive_include_directories output target inc_prop link_prop)
|
||||
get_target_property(dirs ${target} ${inc_prop})
|
||||
if(NOT dirs)
|
||||
set(dirs)
|
||||
endif()
|
||||
get_target_property(deps ${target} ${link_prop})
|
||||
if(deps)
|
||||
foreach(dep IN LISTS deps)
|
||||
if(TARGET ${dep})
|
||||
get_recursive_include_directories(depdirs ${dep} INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES)
|
||||
foreach(depdir IN LISTS depdirs)
|
||||
# Only match absolute paths
|
||||
# We'll hope any non-absolute paths will not get set as system directories
|
||||
if(depdir MATCHES "^/")
|
||||
list(APPEND dirs ${depdir})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES dirs)
|
||||
endif()
|
||||
set(${output} "${dirs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(force_include_last_impl target include inc_prop link_prop)
|
||||
get_recursive_include_directories(dirs ${target} ${inc_prop} ${link_prop})
|
||||
set(remove)
|
||||
foreach(dir IN LISTS dirs)
|
||||
if("${dir}" MATCHES "${include}")
|
||||
list(APPEND remove ${dir})
|
||||
endif()
|
||||
endforeach()
|
||||
if(NOT "${remove}" STREQUAL "")
|
||||
get_target_property(sysdirs ${target} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
|
||||
if(NOT sysdirs)
|
||||
set(sysdirs)
|
||||
endif()
|
||||
# Move matching items to the end
|
||||
list(REMOVE_ITEM dirs ${remove})
|
||||
list(APPEND dirs ${remove})
|
||||
# Set them as system include directories
|
||||
list(APPEND sysdirs ${remove})
|
||||
list(REMOVE_DUPLICATES sysdirs)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
${inc_prop} "${dirs}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${sysdirs}"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(force_include_last target include)
|
||||
force_include_last_impl(${target} "${include}" INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES)
|
||||
force_include_last_impl(${target} "${include}" INCLUDE_DIRECTORIES LINK_LIBRARIES)
|
||||
endfunction()
|
||||
|
@ -1227,6 +1227,10 @@ if (NOT APPLE)
|
||||
endif()
|
||||
|
||||
fixup_file_properties(PCSX2)
|
||||
# Directories like /usr/local/include, /opt/local/include, etc tend to include lots of headers from lots of libraries.
|
||||
# Possibly including libraries that we compiled versions of with the dependency build script.
|
||||
# To ensure the dependency build script's headers are preferred, push any directories that look like */local/include to the end.
|
||||
force_include_last(PCSX2_FLAGS "/(usr|local)/include/?$")
|
||||
|
||||
if (APPLE)
|
||||
find_library(METAL_LIBRARY Metal)
|
||||
|
Loading…
Reference in New Issue
Block a user