diff --git a/lib/jxl_cms.cmake b/lib/jxl_cms.cmake index 59decda2a8a..03c12f63ac3 100644 --- a/lib/jxl_cms.cmake +++ b/lib/jxl_cms.cmake @@ -45,18 +45,25 @@ if (JPEGXL_ENABLE_SKCMS) target_include_directories(jxl_cms-obj PRIVATE $ ) - list(APPEND JXL_CMS_OBJECTS $) - if (NOT JPEGXL_BUNDLE_SKCMS) + if (JPEGXL_BUNDLE_SKCMS) + list(APPEND JXL_CMS_OBJECTS $) + else() message(ERROR "Non-bundles skcms is not currently supported") set(JXL_CMS_LIBS "skcms") set(JXL_CMS_PK_LIBS "-lskcms") - endif () -else () + endif() +else() target_include_directories(jxl_cms-obj PRIVATE $ ) - list(APPEND JXL_CMS_OBJECTS $) -endif () + if (NOT JPEGXL_FORCE_SYSTEM_LCMS2) + list(APPEND JXL_CMS_OBJECTS $) + else() + set(JXL_CMS_LIBS "lcms2") + set(JXL_CMS_PK_LIBS "-llcms2") + endif() +endif() + target_link_libraries(jxl_cms-obj PUBLIC ${JXL_CMS_LIBS}) if (BUILD_SHARED_LIBS) diff --git a/third_party/lcms2.cmake b/third_party/lcms2.cmake index 20ff3462436..330bf95cabd 100644 --- a/third_party/lcms2.cmake +++ b/third_party/lcms2.cmake @@ -75,3 +75,7 @@ else() endif() set_property(TARGET lcms2-obj PROPERTY POSITION_INDEPENDENT_CODE ON) + +add_library(lcms2 STATIC EXCLUDE_FROM_ALL $) +target_include_directories(lcms2 + PUBLIC $)