@@ -134,6 +134,13 @@ function _get_configs_for_android(configs)
134
134
if ndk_cxxstl then
135
135
table.insert (configs , " -DANDROID_STL=" .. ndk_cxxstl )
136
136
end
137
+
138
+ -- avoid find and add system include/library path
139
+ -- @see https://github.com/xmake-io/xmake/issues/2037
140
+ table.insert (configs , " -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH" )
141
+ table.insert (configs , " -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH" )
142
+ table.insert (configs , " -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH" )
143
+ table.insert (configs , " -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER" )
137
144
end
138
145
end
139
146
@@ -195,8 +202,9 @@ function _get_configs_for_mingw(configs)
195
202
-- avoid find and add system include/library path
196
203
envs .CMAKE_FIND_ROOT_PATH = sdkdir
197
204
envs .CMAKE_SYSROOT = sdkdir
198
- envs .CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = " ONLY"
199
- envs .CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = " ONLY"
205
+ envs .CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = " BOTH"
206
+ envs .CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = " BOTH"
207
+ envs .CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = " BOTH"
200
208
envs .CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = " NEVER"
201
209
-- avoid add -isysroot on macOS
202
210
envs .CMAKE_OSX_SYSROOT = " "
@@ -260,8 +268,9 @@ function _get_configs_for_cross(configs)
260
268
-- avoid find and add system include/library path
261
269
envs .CMAKE_FIND_ROOT_PATH = sdkdir
262
270
envs .CMAKE_SYSROOT = sdkdir
263
- envs .CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = " ONLY"
264
- envs .CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = " ONLY"
271
+ envs .CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = " BOTH"
272
+ envs .CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = " BOTH"
273
+ envs .CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = " BOTH"
265
274
envs .CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = " NEVER"
266
275
-- avoid add -isysroot on macOS
267
276
envs .CMAKE_OSX_SYSROOT = " "
0 commit comments