diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2023-09-14 10:27:38 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 10:27:38 +1000 |
commit | fb67e7c258180cd045dbae6ea614ea43beada187 (patch) | |
tree | fa9c09936951c5053fb60b6da43802d0fe569ec8 | |
parent | 7df905b77bb4a8aeb7f31b42368ac418e849660f (diff) | |
parent | 78137d61168f0a8476392ce553ba61daa3a06d8c (diff) |
Merge pull request #23748 from fuzzard/cmake_target2
[cmake] Migrate more modules to TARGET usage
-rw-r--r-- | cmake/modules/FindHarfBuzz.cmake | 49 | ||||
-rw-r--r-- | cmake/modules/FindLCMS2.cmake | 52 | ||||
-rw-r--r-- | cmake/modules/FindRapidJSON.cmake | 5 | ||||
-rw-r--r-- | cmake/modules/FindWaylandProtocolsWebOS.cmake | 21 | ||||
-rw-r--r-- | tools/depends/target/webos-wayland-extensions/Makefile | 6 |
5 files changed, 50 insertions, 83 deletions
diff --git a/cmake/modules/FindHarfBuzz.cmake b/cmake/modules/FindHarfBuzz.cmake index 6691136bbb..44b291c9b8 100644 --- a/cmake/modules/FindHarfBuzz.cmake +++ b/cmake/modules/FindHarfBuzz.cmake @@ -3,44 +3,37 @@ # ------------ # Finds the HarfBuzz library # -# This will define the following variables:: -# -# HARFBUZZ_FOUND - system has HarfBuzz -# HARFBUZZ_INCLUDE_DIRS - the HarfBuzz include directory -# HARFBUZZ_LIBRARIES - the HarfBuzz libraries -# -# and the following imported targets:: +# This will define the following target: # # HarfBuzz::HarfBuzz - The HarfBuzz library -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_HARFBUZZ harfbuzz QUIET) -endif() - -find_path(HARFBUZZ_INCLUDE_DIR NAMES harfbuzz/hb-ft.h hb-ft.h - PATHS ${PC_HARFBUZZ_INCLUDEDIR} - ${PC_HARFBUZZ_INCLUDE_DIRS} - PATH_SUFFIXES harfbuzz) -find_library(HARFBUZZ_LIBRARY NAMES harfbuzz harfbuzz - PATHS ${PC_HARFBUZZ_LIBDIR}) +if(NOT TARGET HarfBuzz::HarfBuzz) + find_package(PkgConfig) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_HARFBUZZ harfbuzz QUIET) + endif() -set(HARFBUZZ_VERSION ${PC_HARFBUZZ_VERSION}) + find_path(HARFBUZZ_INCLUDE_DIR NAMES harfbuzz/hb-ft.h hb-ft.h + HINTS ${PC_HARFBUZZ_INCLUDEDIR} + ${PC_HARFBUZZ_INCLUDE_DIRS} + PATH_SUFFIXES harfbuzz + NO_CACHE) + find_library(HARFBUZZ_LIBRARY NAMES harfbuzz + HINTS ${PC_HARFBUZZ_LIBDIR} + NO_CACHE) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(HarfBuzz - REQUIRED_VARS HARFBUZZ_LIBRARY HARFBUZZ_INCLUDE_DIR - VERSION_VAR HARFBUZZ_VERSION) + set(HARFBUZZ_VERSION ${PC_HARFBUZZ_VERSION}) -if(HARFBUZZ_FOUND) - set(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY}) - set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_INCLUDE_DIR}) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(HarfBuzz + REQUIRED_VARS HARFBUZZ_LIBRARY HARFBUZZ_INCLUDE_DIR + VERSION_VAR HARFBUZZ_VERSION) - if(NOT TARGET HarfBuzz::HarfBuzz) + if(HARFBUZZ_FOUND) add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED) set_target_properties(HarfBuzz::HarfBuzz PROPERTIES IMPORTED_LOCATION "${HARFBUZZ_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIR}") + set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP HarfBuzz::HarfBuzz) endif() endif() - -mark_as_advanced(HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY) 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) - diff --git a/cmake/modules/FindRapidJSON.cmake b/cmake/modules/FindRapidJSON.cmake index bfa8af00c4..44a25b6193 100644 --- a/cmake/modules/FindRapidJSON.cmake +++ b/cmake/modules/FindRapidJSON.cmake @@ -3,10 +3,9 @@ # ----------- # Finds the RapidJSON library # -# This will define the following variables:: +# This will define the following target: # -# RapidJSON_FOUND - system has RapidJSON parser -# RapidJSON_INCLUDE_DIRS - the RapidJSON parser include directory +# RapidJSON::RapidJSON - The RapidJSON library # if(NOT TARGET RapidJSON::RapidJSON) diff --git a/cmake/modules/FindWaylandProtocolsWebOS.cmake b/cmake/modules/FindWaylandProtocolsWebOS.cmake index 979c34d660..041ea2bffa 100644 --- a/cmake/modules/FindWaylandProtocolsWebOS.cmake +++ b/cmake/modules/FindWaylandProtocolsWebOS.cmake @@ -4,24 +4,15 @@ # # This will define the following variables:: # -# WAYLANDPROTOCOLSWEBOS_FOUND - systm has wayland-webos-client # WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR - directory containing the additional webOS Wayland protocols # from the webos-wayland-extensions package -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_WAYLAND_WEBOS_CLIENT wayland-webos-client>=1.0.0) -endif() -find_path(WAYLAND_PROTOCOLS_WEBOS_PROTOCOLDIR NAMES wayland-webos/webos-shell.xml - PATHS ${DEPENDS_PATH}/share) +find_path(WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR NAMES webos-shell.xml + PATH_SUFFIXES wayland-webos + PATHS ${DEPENDS_PATH}/share + REQUIRED) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(WaylandProtocolsWebOS - REQUIRED_VARS WAYLAND_PROTOCOLS_WEBOS_PROTOCOLDIR - VERSION_VAR WAYLAND_WEBOS_SERVER_VERSION) - -if(WAYLANDPROTOCOLSWEBOS_FOUND) - # Promote to cache variables so all code can access it - set(WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR "${WAYLAND_PROTOCOLS_WEBOS_PROTOCOLDIR}/wayland-webos" CACHE INTERNAL "") -endif() +include(FindPackageMessage) +find_package_message(WaylandProtocolsWebOS "Found WaylandProtocols-WebOS: ${WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR}" "[${WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR}]") mark_as_advanced(WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR) diff --git a/tools/depends/target/webos-wayland-extensions/Makefile b/tools/depends/target/webos-wayland-extensions/Makefile index 64d975bd78..90022df192 100644 --- a/tools/depends/target/webos-wayland-extensions/Makefile +++ b/tools/depends/target/webos-wayland-extensions/Makefile @@ -17,12 +17,6 @@ $(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE) .installed-$(PLATFORM): $(PLATFORM) mkdir -p $(PREFIX)/share/wayland-webos $(PREFIX)/lib/pkgconfig - rm -f ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - echo 'includedir=$(PREFIX)/include' >> ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - echo 'Name: wayland-webos-client' >> ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - echo 'Description: wayland-webos-client' >> ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - echo 'Version: 1.0.0' >> ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - cp $(PLATFORM)/protocol/webos-shell.xml $(PREFIX)/share/wayland-webos cp $(PLATFORM)/protocol/webos-foreign.xml $(PREFIX)/share/wayland-webos touch $@ |