From a09352872b2f1a9db452d9cc313088abd5fb75c0 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Sat, 26 Aug 2023 14:04:20 +0800 Subject: Add sysroot to GLH & Meshoptimizer include paths When cross-compiling, the host's /usr/local/include would be unsafely included before. The problem with this was that it leaked other host library headers unexpectedly, like Boost. The target compilation caught some function from the host headers which of a newer version, and then when trying to link to the target libraries, the function wasn't available yet in the older version. --- indra/cmake/GLH.cmake | 7 ++++--- indra/cmake/Meshoptimizer.cmake | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/cmake/GLH.cmake b/indra/cmake/GLH.cmake index 49c4e3b37a..09f7d568be 100644 --- a/indra/cmake/GLH.cmake +++ b/indra/cmake/GLH.cmake @@ -3,9 +3,10 @@ include(Prebuilt) add_library( ll::glh_linear INTERFACE IMPORTED ) -if (NOT (USE_AUTOBUILD_3P OR USE_CONAN)) - target_include_directories( ll::glh_linear SYSTEM INTERFACE /usr/local/include ) - return () +if (USESYSTEMLIBS) + target_include_directories(ll::glh_linear SYSTEM INTERFACE + ${CMAKE_SYSROOT}/usr/local/include) + return () endif () use_system_binary( glh_linear ) diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake index 6cf8343dd6..70b3a2c088 100644 --- a/indra/cmake/Meshoptimizer.cmake +++ b/indra/cmake/Meshoptimizer.cmake @@ -7,7 +7,7 @@ include_guard() add_library( ll::meshoptimizer INTERFACE IMPORTED ) if (NOT (USE_AUTOBUILD_3P OR USE_CONAN)) - target_include_directories( ll::meshoptimizer SYSTEM INTERFACE /usr/local/include ) + target_include_directories( ll::meshoptimizer SYSTEM INTERFACE ${CMAKE_SYSROOT}/usr/local/include ) target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer) return () endif () -- cgit v1.2.3