diff --git a/CMakeLists.txt b/CMakeLists.txt index 280d4af..c9186df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,6 +127,8 @@ set(JPEGXL_FORCE_SYSTEM_BROTLI false CACHE BOOL "Force using system installed brotli instead of third_party/brotli source.") set(JPEGXL_FORCE_SYSTEM_HWY false CACHE BOOL "Force using system installed highway (libhwy-dev) instead of third_party/highway source.") +set(JPEGXL_FORCE_SYSTEM_LCMS false CACHE BOOL + "Force using system installed lcms instead of third_party/lcms source.") # Check minimum compiler versions. Older compilers are not supported and fail # with hard to understand errors. diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index b5e1899..887d31d 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -201,13 +201,23 @@ if (JPEGXL_ENABLE_SKCMS OR JPEGXL_ENABLE_PLUGINS) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/skcms/LICENSE" ${PROJECT_BINARY_DIR}/LICENSE.skcms COPYONLY) endif () -if (JPEGXL_ENABLE_VIEWERS OR NOT JPEGXL_ENABLE_SKCMS) - if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lcms/.git" ) - message(SEND_ERROR "Please run git submodule update --init") +if ((JPEGXL_ENABLE_VIEWERS OR NOT JPEGXL_ENABLE_SKCMS)) + if(JPEGXL_FORCE_SYSTEM_LCMS) + pkg_check_modules(LCMS REQUIRED IMPORTED_TARGET lcms2) + add_library(lcms2 INTERFACE IMPORTED GLOBAL) + target_link_libraries(lcms2 INTERFACE PkgConfig::LCMS) + else() + if(JPEGXL_DEP_LICENSE_DIR) + configure_file("${JPEGXL_DEP_LICENSE_DIR}/libhwy-dev/copyright" + ${PROJECT_BINARY_DIR}/LICENSE.highway COPYONLY) + endif() # JPEGXL_DEP_LICENSE_DIR + if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lcms/.git" ) + message(SEND_ERROR "Please run git submodule update --init") + endif() + include(lcms2.cmake) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lcms/COPYING" + ${PROJECT_BINARY_DIR}/LICENSE.lcms COPYONLY) endif() - include(lcms2.cmake) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lcms/COPYING" - ${PROJECT_BINARY_DIR}/LICENSE.lcms COPYONLY) endif() # sjpeg