4 # Finds the LCMS Color Management library
6 # This will define the following target:
8 # ${APP_NAME_LC}::LCMS2 - The LCMS Color Management library
10 if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
11 if(LCMS2_FIND_VERSION)
12 if(LCMS2_FIND_VERSION_EXACT)
13 set(LCMS2_FIND_SPEC "=${LCMS2_FIND_VERSION_COMPLETE}")
15 set(LCMS2_FIND_SPEC ">=${LCMS2_FIND_VERSION_COMPLETE}")
19 find_package(PkgConfig)
20 if(PKG_CONFIG_FOUND AND NOT (WIN32 OR WINDOWS_STORE))
21 pkg_check_modules(PC_LCMS2 lcms2${LCMS2_FIND_SPEC} QUIET)
24 find_path(LCMS2_INCLUDE_DIR NAMES lcms2.h
25 HINTS ${DEPENDS_PATH}/include ${PC_LCMS2_INCLUDEDIR})
26 find_library(LCMS2_LIBRARY NAMES lcms2 liblcms2
27 HINTS ${DEPENDS_PATH}/lib ${PC_LCMS2_LIBDIR})
29 set(LCMS2_VERSION ${PC_LCMS2_VERSION})
31 include(FindPackageHandleStandardArgs)
32 find_package_handle_standard_args(LCMS2
33 REQUIRED_VARS LCMS2_LIBRARY LCMS2_INCLUDE_DIR
34 VERSION_VAR LCMS2_VERSION)
37 add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
38 set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
39 IMPORTED_LOCATION "${LCMS2_LIBRARY}"
40 INTERFACE_INCLUDE_DIRECTORIES "${LCMS2_INCLUDE_DIR}"
41 INTERFACE_COMPILE_DEFINITIONS "HAVE_LCMS2;CMS_NO_REGISTER_KEYWORD")