Skip to content

Commit

Permalink
update cmake trybuild
Browse files Browse the repository at this point in the history
  • Loading branch information
zjyhjqs committed May 26, 2024
1 parent 3f836b6 commit 0d2d893
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions xmake/modules/private/action/trybuild/cmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ function _get_configs_for_android(configs)
if ndk_cxxstl then
table.insert(configs, "-DANDROID_STL=" .. ndk_cxxstl)
end

-- avoid find and add system include/library path
-- @see https://github.com/xmake-io/xmake/issues/2037
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH")
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH")
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH")
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER")
end
end

Expand Down Expand Up @@ -195,8 +202,9 @@ function _get_configs_for_mingw(configs)
-- avoid find and add system include/library path
envs.CMAKE_FIND_ROOT_PATH = sdkdir
envs.CMAKE_SYSROOT = sdkdir
envs.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "ONLY"
envs.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "ONLY"
envs.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "NEVER"
-- avoid add -isysroot on macOS
envs.CMAKE_OSX_SYSROOT = ""
Expand Down Expand Up @@ -260,8 +268,9 @@ function _get_configs_for_cross(configs)
-- avoid find and add system include/library path
envs.CMAKE_FIND_ROOT_PATH = sdkdir
envs.CMAKE_SYSROOT = sdkdir
envs.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "ONLY"
envs.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "ONLY"
envs.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "NEVER"
-- avoid add -isysroot on macOS
envs.CMAKE_OSX_SYSROOT = ""
Expand Down

0 comments on commit 0d2d893

Please sign in to comment.