Skip to content

Commit c96d7ed

Browse files
committed
Simplify overriding upstream find modules
1 parent cdc2693 commit c96d7ed

File tree

4 files changed

+12
-28
lines changed

4 files changed

+12
-28
lines changed

cmake/cmake/modules/FindICU.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,9 @@ if(PKG_CONFIG_FOUND)
3737
endif()
3838
endif()
3939

40-
# Find package with upstream CMake module; override CMAKE_MODULE_PATH to prevent
41-
# the maximum nesting/recursion depth error on some systems, like macOS.
42-
set(_php_cmake_module_path ${CMAKE_MODULE_PATH})
43-
unset(CMAKE_MODULE_PATH)
44-
include(FindICU)
45-
set(CMAKE_MODULE_PATH ${_php_cmake_module_path})
46-
unset(_php_cmake_module_path)
40+
# Find package with upstream CMake find module. Absolute path prevents the
41+
# maximum nesting/recursion depth error on some systems, like macOS.
42+
include(${CMAKE_ROOT}/Modules/FindICU.cmake)
4743

4844
# Upstream CMake module doesn't mark these as advanced variables.
4945
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9199

cmake/cmake/modules/FindIconv.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ if(CMAKE_PREFIX_PATH OR Iconv_ROOT OR ICONV_ROOT)
4949
endif()
5050
endif()
5151

52-
# Find package with upstream CMake module; override CMAKE_MODULE_PATH to prevent
53-
# the maximum nesting/recursion depth error on some systems, like macOS.
54-
set(_php_cmake_module_path ${CMAKE_MODULE_PATH})
55-
unset(CMAKE_MODULE_PATH)
56-
include(FindIconv)
57-
set(CMAKE_MODULE_PATH ${_php_cmake_module_path})
58-
unset(_php_cmake_module_path)
52+
# Find package with upstream CMake find module. Absolute path prevents the
53+
# maximum nesting/recursion depth error on some systems, like macOS.
54+
include(${CMAKE_ROOT}/Modules/FindIconv.cmake)

cmake/cmake/modules/FindIntl.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ if(CMAKE_PREFIX_PATH OR Intl_ROOT OR INTL_ROOT)
3838
endif()
3939
endif()
4040

41-
# Find package with upstream CMake module; override CMAKE_MODULE_PATH to prevent
42-
# the maximum nesting/recursion depth error on some systems, like macOS.
43-
set(_php_cmake_module_path ${CMAKE_MODULE_PATH})
44-
unset(CMAKE_MODULE_PATH)
45-
include(FindIntl)
46-
set(CMAKE_MODULE_PATH ${_php_cmake_module_path})
47-
unset(_php_cmake_module_path)
41+
# Find package with upstream CMake find module. Absolute path prevents the
42+
# maximum nesting/recursion depth error on some systems, like macOS.
43+
include(${CMAKE_ROOT}/Modules/FindIntl.cmake)

cmake/cmake/modules/FindLibXslt.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@ set_package_properties(
2121
DESCRIPTION "XSLT processor library"
2222
)
2323

24-
# Find package with upstream CMake module; override CMAKE_MODULE_PATH to prevent
25-
# the maximum nesting/recursion depth error on some systems, like macOS.
26-
set(_php_cmake_module_path ${CMAKE_MODULE_PATH})
27-
unset(CMAKE_MODULE_PATH)
28-
include(FindLibXslt)
29-
set(CMAKE_MODULE_PATH ${_php_cmake_module_path})
30-
unset(_php_cmake_module_path)
24+
# Find package with upstream CMake find module. Absolute path prevents the
25+
# maximum nesting/recursion depth error on some systems, like macOS.
26+
include(${CMAKE_ROOT}/Modules/FindLibXslt.cmake)
3127

3228
# Upstream CMake module doesn't mark these as advanced variables.
3329
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8807

0 commit comments

Comments
 (0)