Skip to content

Commit b786ee8

Browse files
committed
Allow find_package CONFIG mode with Package_ROOT
Signed-off-by: Rémi Achard <[email protected]>
1 parent 086c2a9 commit b786ee8

File tree

6 files changed

+25
-35
lines changed

6 files changed

+25
-35
lines changed

share/cmake/modules/FindImath.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
4040
set(_Imath_REQUIRED_VARS Imath_LIBRARY)
4141
set(_Imath_LIB_VER "${Imath_FIND_VERSION_MAJOR}_${Imath_FIND_VERSION_MINOR}")
4242

43-
if(NOT DEFINED Imath_ROOT)
44-
# Search for ImathConfig.cmake
45-
find_package(Imath ${Imath_FIND_VERSION} CONFIG QUIET)
46-
endif()
43+
# Search for ImathConfig.cmake
44+
find_package(Imath ${Imath_FIND_VERSION} CONFIG QUIET)
4745

4846
if(Imath_FOUND)
4947
get_target_property(Imath_LIBRARY Imath::Imath LOCATION)

share/cmake/modules/FindOSL.cmake

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@
2929
###############################################################################
3030
### Try to find package ###
3131

32-
if(NOT DEFINED OSL_ROOT)
33-
find_package(OSL ${OSL_FIND_VERSION} CONFIG QUIET)
34-
35-
set(OSL_SHADERS_INCLUDE_DIR ${OSL_INCLUDE_DIR}/../share)
36-
# Variable used by the OSL unit tests.
37-
set(OSL_SHADERS_DIR ${OSL_SHADERS_INCLUDE_DIR}/OSL/shaders)
38-
39-
include (FindPackageHandleStandardArgs)
40-
find_package_handle_standard_args (OSL
41-
REQUIRED_VARS
42-
OSL_INCLUDE_DIR
43-
OSL_LIB_DIR
44-
VERSION_VAR
45-
OSL_VERSION
46-
)
47-
else()
32+
find_package(OSL ${OSL_FIND_VERSION} CONFIG QUIET)
33+
34+
set(OSL_SHADERS_INCLUDE_DIR ${OSL_INCLUDE_DIR}/../share)
35+
# Variable used by the OSL unit tests.
36+
set(OSL_SHADERS_DIR ${OSL_SHADERS_INCLUDE_DIR}/OSL/shaders)
37+
38+
include (FindPackageHandleStandardArgs)
39+
find_package_handle_standard_args (OSL
40+
REQUIRED_VARS
41+
OSL_INCLUDE_DIR
42+
OSL_LIB_DIR
43+
VERSION_VAR
44+
OSL_VERSION
45+
)
46+
47+
if(NOT OSL_FOUND)
4848
set(OSL_INCLUDE_DIR ${OSL_ROOT}/include)
4949
set(OSL_VERSION_HEADER "${OSL_INCLUDE_DIR}/OSL/oslversion.h")
5050

share/cmake/modules/Findexpat.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ endif()
3939
if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
4040
set(_expat_REQUIRED_VARS expat_LIBRARY)
4141

42-
if(NOT DEFINED expat_ROOT)
43-
# Search for expat-config.cmake
44-
find_package(expat ${expat_FIND_VERSION} CONFIG QUIET)
45-
endif()
42+
# Search for expat-config.cmake
43+
find_package(expat ${expat_FIND_VERSION} CONFIG QUIET)
4644

4745
if(expat_FOUND)
4846
if (TARGET expat::libexpat)

share/cmake/modules/Findminizip-ng.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
4545
endif()
4646

4747
if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
48-
if(NOT DEFINED minizip-ng_ROOT)
49-
# Search for minizip-ng-config.cmake
50-
find_package(minizip-ng ${minizip-ng_FIND_VERSION} CONFIG QUIET)
51-
endif()
48+
# Search for minizip-ng-config.cmake
49+
find_package(minizip-ng ${minizip-ng_FIND_VERSION} CONFIG QUIET)
5250

5351
if (minizip-ng_FOUND)
5452
get_target_property(minizip-ng_INCLUDE_DIR MINIZIP::minizip-ng INTERFACE_INCLUDE_DIRECTORIES)

share/cmake/modules/Findpybind11.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
### Try to find package ###
2525

2626
if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
27-
if(NOT DEFINED pybind11_ROOT)
28-
# Search for pybind11Config.cmake
29-
find_package(pybind11 ${pybind11_FIND_VERSION} CONFIG QUIET)
30-
endif()
27+
# Search for pybind11Config.cmake
28+
find_package(pybind11 ${pybind11_FIND_VERSION} CONFIG QUIET)
3129

3230
if(NOT pybind11_FOUND)
3331
# Find include directory

share/cmake/modules/Findyaml-cpp.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
4444
set(_yaml-cpp_REQUIRED_VARS yaml-cpp_LIBRARY)
4545

4646
# Search for yaml-cpp-config.cmake
47-
if(NOT DEFINED yaml-cpp_ROOT)
48-
find_package(yaml-cpp ${yaml-cpp_FIND_VERSION} CONFIG ${quiet})
49-
endif()
47+
find_package(yaml-cpp ${yaml-cpp_FIND_VERSION} CONFIG ${quiet})
5048

5149
if(yaml-cpp_FOUND)
5250
# Alias target for yaml-cpp < 0.8 compatibility

0 commit comments

Comments
 (0)