From 2153c3484326f1000643f1ddbd3b8b9979cfa76c Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Thu, 6 Mar 2025 14:55:10 +0100 Subject: [PATCH 1/2] cmake: use of imported Freetype target --- cmake/modules/CheckDependentLibraries.cmake | 10 +--------- general/CMakeLists.txt | 4 ++-- lib/CMakeLists.txt | 4 ++-- vector/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/cmake/modules/CheckDependentLibraries.cmake b/cmake/modules/CheckDependentLibraries.cmake index b45b2b751ee..842f5980af5 100644 --- a/cmake/modules/CheckDependentLibraries.cmake +++ b/cmake/modules/CheckDependentLibraries.cmake @@ -175,14 +175,6 @@ endif() # Language options if(WITH_FREETYPE) find_package(Freetype REQUIRED) - if(FREETYPE_FOUND) - add_library(FREETYPE INTERFACE IMPORTED GLOBAL) - set_property( - TARGET FREETYPE PROPERTY INTERFACE_LINK_LIBRARIES - ${FREETYPE_LIBRARY${find_library_suffix}}) - set_property(TARGET FREETYPE PROPERTY INTERFACE_INCLUDE_DIRECTORIES - ${FREETYPE_INCLUDE_DIRS}) - endif() endif() if(WITH_NLS) @@ -337,7 +329,7 @@ check_target(ZSTD HAVE_ZSTD_H) check_target(BZIP2 HAVE_BZLIB_H) check_target(Readline::Readline HAVE_READLINE_READLINE_H) check_target(Readline::History HAVE_READLINE_HISTORY_H) -check_target(FREETYPE HAVE_FT2BUILD_H) +check_target(Freetype::Freetype HAVE_FT2BUILD_H) # set(CMAKE_REQUIRED_INCLUDES "${FFTW_INCLUDE_DIR}") no target ATLAS in # thirdpary/CMakeLists.txt check_target(ATLAS HAVE_LIBATLAS) diff --git a/general/CMakeLists.txt b/general/CMakeLists.txt index f143daf6aa3..98409ad319f 100644 --- a/general/CMakeLists.txt +++ b/general/CMakeLists.txt @@ -8,7 +8,7 @@ build_program_in_subdir(g.gisenv DEPENDS grass_gis) build_program_in_subdir(g.mapset DEPENDS grass_gis) build_program_in_subdir(g.mapsets DEPENDS grass_gis grass_parson) build_program_in_subdir(g.message DEPENDS grass_gis) -build_program_in_subdir(g.mkfontcap DEPENDS grass_gis FREETYPE) +build_program_in_subdir(g.mkfontcap DEPENDS grass_gis Freetype::Freetype) add_dependencies(g.mkfontcap fonts) add_custom_command( TARGET g.mkfontcap @@ -17,7 +17,7 @@ add_custom_command( > ${OUTDIR}/${GRASS_INSTALL_ETCDIR}/fontcap) install(FILES ${OUTDIR}/${GRASS_INSTALL_ETCDIR}/fontcap DESTINATION ${GRASS_INSTALL_ETCDIR}) -build_program_in_subdir(g.parser DEPENDS grass_gis FREETYPE) +build_program_in_subdir(g.parser DEPENDS grass_gis) build_program_in_subdir(g.pnmcomp DEPENDS grass_gis) build_program_in_subdir(g.ppmtopng DEPENDS grass_gis PRIMARY_DEPENDS PNG::PNG) build_program_in_subdir(g.proj DEPENDS grass_gis grass_gproj PROJ OPTIONAL_DEPENDS GDAL::GDAL) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index a693b3fcb40..9b9be85cb94 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -13,8 +13,8 @@ build_library_in_subdir( "${use_math_DEFS}" DEPENDS grass_gis - FREETYPE OPTIONAL_DEPENDS + Freetype::Freetype Iconv::Iconv) add_subdirectory(proj) @@ -109,7 +109,7 @@ set(_grass_display_DEPENDS grass_driver grass_raster grass_htmldriver grass_pngdriver grass_psdriver grass_gis) if(WITH_CAIRO) - set(_cairodriver_DEPENDS CAIRO FREETYPE grass_gis grass_driver + set(_cairodriver_DEPENDS CAIRO Freetype::Freetype grass_gis grass_driver OPTIONAL_DEPENDS Iconv::Iconv) if(WITH_X11) list(APPEND _cairodriver_DEPENDS X11) diff --git a/vector/CMakeLists.txt b/vector/CMakeLists.txt index ca061a307fa..a1a5afcb4f8 100644 --- a/vector/CMakeLists.txt +++ b/vector/CMakeLists.txt @@ -369,7 +369,7 @@ build_program_in_subdir( build_program_in_subdir( v.label.sa DEPENDS - FREETYPE + Freetype::Freetype grass_dbmibase grass_dbmiclient grass_dbmidriver From b105c90f75161b51f05ec9466b6225e7ea4be771 Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Thu, 6 Mar 2025 20:55:38 +0100 Subject: [PATCH 2/2] use PRIMARY_DEPENDS --- general/CMakeLists.txt | 3 ++- vector/CMakeLists.txt | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/general/CMakeLists.txt b/general/CMakeLists.txt index 98409ad319f..2991596c2bd 100644 --- a/general/CMakeLists.txt +++ b/general/CMakeLists.txt @@ -8,7 +8,8 @@ build_program_in_subdir(g.gisenv DEPENDS grass_gis) build_program_in_subdir(g.mapset DEPENDS grass_gis) build_program_in_subdir(g.mapsets DEPENDS grass_gis grass_parson) build_program_in_subdir(g.message DEPENDS grass_gis) -build_program_in_subdir(g.mkfontcap DEPENDS grass_gis Freetype::Freetype) +build_program_in_subdir(g.mkfontcap DEPENDS grass_gis PRIMARY_DEPENDS + Freetype::Freetype) add_dependencies(g.mkfontcap fonts) add_custom_command( TARGET g.mkfontcap diff --git a/vector/CMakeLists.txt b/vector/CMakeLists.txt index a1a5afcb4f8..4845790c914 100644 --- a/vector/CMakeLists.txt +++ b/vector/CMakeLists.txt @@ -369,7 +369,6 @@ build_program_in_subdir( build_program_in_subdir( v.label.sa DEPENDS - Freetype::Freetype grass_dbmibase grass_dbmiclient grass_dbmidriver @@ -377,7 +376,9 @@ build_program_in_subdir( grass_display grass_gis grass_vector - ${LIBM}) + ${LIBM} + PRIMARY_DEPENDS + Freetype::Freetype) build_program_in_subdir(v.proj DEPENDS grass_gis grass_gproj grass_vector ${LIBM})