Skip to content

Commit

Permalink
Small tweak in the configuration of OpenColorIO.cmake.in to handle ab…
Browse files Browse the repository at this point in the history
…solute path with CMAKE_INSTALL_LIBDIR or CMAKE_INSTALL_INCLUDEDIR.

Keeping exec_prefix for CMAKE_INSTALL_INCLUDE_DIR since it was changed for a specific issue on Mac (see PR AcademySoftwareFoundation#1120).

Signed-off-by: Cédrik Fuoco <[email protected]>
  • Loading branch information
cedrik-fuoco-adsk committed Nov 29, 2022
1 parent 6cf65ed commit 54f247e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/OpenColorIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,23 @@ set(SOURCES

set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}")

# CMAKE_INSTALL_LIBDIR is not guaranteed to be relative.
# Not using cmake_path function since it is only available from CMake ≥ 3.20.
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(libdir "${CMAKE_INSTALL_LIBDIR}")
else()
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()

# CMAKE_INSTALL_INCLUDEDIR is not guaranteed to be relative.
# Not using cmake_path function since it is only available from CMake ≥ 3.20.
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(includedir "\${exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()

configure_file(res/OpenColorIO.pc.in ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

Expand Down

0 comments on commit 54f247e

Please sign in to comment.