summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2023-08-26 14:04:20 +0800
committerErik Kundiman <erik@megapahit.org>2023-08-26 14:04:20 +0800
commita09352872b2f1a9db452d9cc313088abd5fb75c0 (patch)
treee65b43e62c02a64b7e01a45442774560bd1186a4
parente902a39a049f2378be0b5ee13595a58cfce2d937 (diff)
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.
-rw-r--r--indra/cmake/GLH.cmake7
-rw-r--r--indra/cmake/Meshoptimizer.cmake2
2 files changed, 5 insertions, 4 deletions
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 ()