Skip to content

Commit

Permalink
Use PACKAGE_PREFIX_DIR from PACKAGE_INIT.
Browse files Browse the repository at this point in the history
This avoids guessing the path to the prefix.

Signed-off-by: Pierre Wendling <[email protected]>
  • Loading branch information
FtZPetruska committed Aug 17, 2023
1 parent d522939 commit 6373161
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/cmake/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,9 @@ if (NOT @BUILD_SHARED_LIBS@) # NOT @BUILD_SHARED_LIBS@
set(CMAKE_FIND_APPBUNDLE LAST)
endif()

# Get the install directory.
set(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}")
# Get the install directory. Since the current file is under
# <install directory>/lib/cmake/OpenColorIO going back three directory.
foreach(i RANGE 1 3)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
break()
endif()
endforeach()

# Append OCIO custom find module path.
list(APPEND CMAKE_MODULE_PATH "${_IMPORT_PREFIX}/share/OpenColorIO/cmake/modules")
list(APPEND CMAKE_MODULE_PATH "${_IMPORT_PREFIX}/share/OpenColorIO/cmake/macros")
list(APPEND CMAKE_MODULE_PATH "${PACKAGE_PREFIX_DIR}/share/OpenColorIO/cmake/modules")
list(APPEND CMAKE_MODULE_PATH "${PACKAGE_PREFIX_DIR}/share/OpenColorIO/cmake/macros")

########################
# Required dependencies
Expand Down

0 comments on commit 6373161

Please sign in to comment.