aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@kodi.tv>2023-09-05 18:00:09 +1000
committerfuzzard <fuzzard@kodi.tv>2023-09-11 09:52:57 +1000
commit94250a03ad5ba7365e9492fb3f12f79820d5af3d (patch)
treee8f1e2d789caa20d849431183776677f2ab85085
parent4f532d3fb9fbff83f655634612e15297fbd1cbf6 (diff)
[cmake] FindLCMS2 migrate to full TARGET usage
-rw-r--r--cmake/modules/FindLCMS2.cmake52
1 files changed, 21 insertions, 31 deletions
diff --git a/cmake/modules/FindLCMS2.cmake b/cmake/modules/FindLCMS2.cmake
index d02515815d..73075d8997 100644
--- a/cmake/modules/FindLCMS2.cmake
+++ b/cmake/modules/FindLCMS2.cmake
@@ -3,46 +3,36 @@
# -----------
# Finds the LCMS Color Management library
#
-# This will define the following variables::
+# This will define the following target:
#
-# LCMS2_FOUND - system has LCMS Color Management
-# LCMS2_INCLUDE_DIRS - the LCMS Color Management include directory
-# LCMS2_LIBRARIES - the LCMS Color Management libraries
-# LCMS2_DEFINITIONS - the LCMS Color Management definitions
-#
-# and the following imported targets::
-#
-# LCMS2::LCMS2 - The LCMS Color Management library
-
-if(PKG_CONFIG_FOUND)
- pkg_check_modules(PC_LCMS2 lcms2>=2.10 QUIET)
-endif()
+# LCMS2::LCMS2 - The LCMS Color Management library
-find_path(LCMS2_INCLUDE_DIR NAMES lcms2.h
- PATHS ${PC_LCMS2_INCLUDEDIR})
-find_library(LCMS2_LIBRARY NAMES lcms2 liblcms2
- PATHS ${PC_LCMS2_LIBDIR})
+if(NOT TARGET LCMS2::LCMS2)
+ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LCMS2 lcms2>=2.10 QUIET)
+ endif()
-set(LCMS2_VERSION ${PC_LCMS2_VERSION})
+ find_path(LCMS2_INCLUDE_DIR NAMES lcms2.h
+ HINTS ${PC_LCMS2_INCLUDEDIR}
+ NO_CACHE)
+ find_library(LCMS2_LIBRARY NAMES lcms2 liblcms2
+ HINTS ${PC_LCMS2_LIBDIR}
+ NO_CACHE)
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(LCMS2
- REQUIRED_VARS LCMS2_LIBRARY LCMS2_INCLUDE_DIR
- VERSION_VAR LCMS2_VERSION)
+ set(LCMS2_VERSION ${PC_LCMS2_VERSION})
-if(LCMS2_FOUND)
- set(LCMS2_LIBRARIES ${LCMS2_LIBRARY})
- set(LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
- set(LCMS2_DEFINITIONS -DHAVE_LCMS2=1 -DCMS_NO_REGISTER_KEYWORD=1)
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(LCMS2
+ REQUIRED_VARS LCMS2_LIBRARY LCMS2_INCLUDE_DIR
+ VERSION_VAR LCMS2_VERSION)
- if(NOT TARGET LCMS2::LCMS2)
+ if(LCMS2_FOUND)
add_library(LCMS2::LCMS2 UNKNOWN IMPORTED)
set_target_properties(LCMS2::LCMS2 PROPERTIES
IMPORTED_LOCATION "${LCMS2_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LCMS2_INCLUDE_DIR}"
- INTERFACE_COMPILE_DEFINITIONS HAVE_LCMS2=1)
+ INTERFACE_COMPILE_DEFINITIONS "HAVE_LCMS2=1;CMS_NO_REGISTER_KEYWORD=1")
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP LCMS2::LCMS2)
endif()
endif()
-
-mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
-