From c115bbed453f53e33508410b8df057dcd801d0dc Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Tue, 6 Jan 2026 14:05:46 +0100 Subject: [PATCH 1/4] cmake: export targets --- CMakeLists.txt | 39 +++++++++++------- GRASSConfig.cmake.in | 71 ++++++++++++++++++++++++++++++++ cmake/modules/build_module.cmake | 35 +++++++++++++--- cmake/modules/get_versions.cmake | 8 +++- lib/CMakeLists.txt | 4 +- lib/db/CMakeLists.txt | 10 ++--- lib/proj/CMakeLists.txt | 2 +- raster/r.sim/CMakeLists.txt | 4 +- 8 files changed, 142 insertions(+), 31 deletions(-) create mode 100644 GRASSConfig.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 1327577f0f6..97beef5f022 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,22 @@ if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET) set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "") endif() ]] +set(CMAKE_MODULE_PATH + "${CMAKE_SOURCE_DIR}/cmake/find_scripts;${CMAKE_SOURCE_DIR}/cmake/modules;${CMAKE_MODULE_PATH}" +) + +include(get_versions) +get_versions("include/VERSION" GRASS_VERSION_MAJOR GRASS_VERSION_MINOR + GRASS_VERSION_RELEASE GRASS_VERSION_SUFFIX GRASS_VERSION_DATE) -project(GRASS) +set(GRASS_VERSION_NUMBER + ${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE}${GRASS_VERSION_SUFFIX}) +set(GRASS_VERSION_STRING ${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE}) +message(STATUS "GRASS_VERSION_NUMBER = '${GRASS_VERSION_NUMBER}'") +set(GRASS_VERSION_UPDATE_PKG "0.2") + +project(GRASS VERSION ${GRASS_VERSION_STRING} + HOMEPAGE_URL https://grass.osgeo.org) string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) set(BUILD_SHARED_LIBS ON) @@ -32,10 +46,6 @@ if(MSVC) set_property(GLOBAL PROPERTY USE_FOLDERS ON) endif() -set(CMAKE_MODULE_PATH - "${CMAKE_SOURCE_DIR}/cmake/find_scripts;${CMAKE_SOURCE_DIR}/cmake/modules;${CMAKE_MODULE_PATH}" -) - if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -146,15 +156,6 @@ include(CheckDependentLibraries) include(get_host_arch) get_host_arch(BUILD_ARCH) -include(get_versions) -get_versions("include/VERSION" GRASS_VERSION_MAJOR GRASS_VERSION_MINOR - GRASS_VERSION_RELEASE GRASS_VERSION_DATE) - -set(GRASS_VERSION_NUMBER - ${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE}) -message(STATUS "GRASS_VERSION_NUMBER = '${GRASS_VERSION_NUMBER}'") -set(GRASS_VERSION_UPDATE_PKG "0.2") - # Setup GRASS install directories include(GRASSInstallDirs) @@ -334,3 +335,13 @@ endif() if(WITH_X11) build_program_in_subdir(visualization/ximgview DEPENDS grass_gis X11::X11) endif() + +include(CMakePackageConfigHelpers) +configure_package_config_file(GRASSConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GRASSConfig.cmake + INSTALL_DESTINATION ${GRASS_INSTALL_CMAKECONFDIR}/GRASS) +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/GRASSConfigVersion.cmake + VERSION ${GRASS_VERSION_STRING} + COMPATIBILITY ExactVersion) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GRASSConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/GRASSConfigVersion.cmake + DESTINATION ${GRASS_INSTALL_CMAKECONFDIR}/GRASS) diff --git a/GRASSConfig.cmake.in b/GRASSConfig.cmake.in new file mode 100644 index 00000000000..d7fb0379d47 --- /dev/null +++ b/GRASSConfig.cmake.in @@ -0,0 +1,71 @@ +@PACKAGE_INIT@ + +set(_GRASS_supported_components + arraystats + bitmap + btree + btree2 + cairodriver + calc + ccmath + cdhc + cluster + datetime + dbmibase + dbmiclient + dbmidriver + dbstubs + dgl + dig2 + display + driver + dspf + gis + gmath + gpde + gproj + htmldriver + imagery + interpdata + interpfl + iortho + iostream + lidar + linkm + lrs + manage + neta + nviz + ogsf + parson + pngdriver + psdriver + qtree + raster + raster3d + rli + rowio + rtree + segment + shape + sim + sqlp + stats + symb + temporal + vector + vedit) + +foreach(_comp ${GRASS_FIND_COMPONENTS}) + if(NOT _comp IN_LIST _GRASS_supported_components) + set(GRASS_FOUND False) + set(GRASS_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") + endif() + include("${CMAKE_CURRENT_LIST_DIR}/GRASS_${_comp}Targets.cmake") +endforeach() + +set(GRASS_VERSION_DATE "@GRASS_VERSION_DATE@") +set(GRASS_VERSION_GIT "@GRASS_VERSION_GIT@") +set(GRASS_VERSION_STRING "@GRASS_VERSION_NUMBER@") +set(GRASS_CMAKE_DIR "@CMAKE_INSTALL_PREFIX@/@GRASS_INSTALL_ETCDIR@/cmake") +set(GRASS_UTILS_DIR "@CMAKE_INSTALL_PREFIX@/@GRASS_INSTALL_UTILSDIR@") diff --git a/cmake/modules/build_module.cmake b/cmake/modules/build_module.cmake index d5a0b713979..fac4557bc85 100644 --- a/cmake/modules/build_module.cmake +++ b/cmake/modules/build_module.cmake @@ -123,12 +123,16 @@ function(build_module) CACHE INTERNAL "list of modules") else() + string(REPLACE "grass_" "" _libname ${G_NAME}) add_library(${G_NAME} ${${G_NAME}_SRCS}) set_target_properties( ${G_NAME} PROPERTIES FOLDER lib VERSION ${GRASS_VERSION_NUMBER} - SOVERSION ${GRASS_VERSION_MAJOR}) + SOVERSION ${GRASS_VERSION_MAJOR} + EXPORT_NAME ${_libname}) + + add_library(GRASS::${_libname} ALIAS ${G_NAME}) # TODO: check when and where the export header files are needed set(export_file_name @@ -174,8 +178,8 @@ function(build_module) if(${G_NAME}_INCLUDE_DIRS) list(REMOVE_DUPLICATES ${G_NAME}_INCLUDE_DIRS) endif() - - target_include_directories(${G_NAME} PUBLIC ${${G_NAME}_INCLUDE_DIRS}) + target_include_directories( + ${G_NAME} PUBLIC "$") endforeach() foreach(G_DEF ${G_DEFS}) @@ -251,8 +255,8 @@ function(build_module) if(RUN_HTML_DESCR) set(html_descr_command - ${G_NAME}${PGM_EXT} --html-description < ${NULL_DEVICE} | ${SEARCH_COMMAND} - ${HTML_SEARCH_STR}) + ${G_NAME}${PGM_EXT} --html-description < ${NULL_DEVICE} | + ${SEARCH_COMMAND} ${HTML_SEARCH_STR}) else() set(html_descr_command ${CMAKE_COMMAND} -E echo) endif() @@ -289,6 +293,25 @@ function(build_module) message("[build_module] ADDING TEST ${G_NAME}-test") endforeach() - install(TARGETS ${G_NAME} DESTINATION ${install_dest}) + if(NOT G_EXE) + string(REPLACE "grass_" "" _libname ${G_NAME}) + install( + TARGETS ${G_NAME} + EXPORT ${_libname}Targets + LIBRARY DESTINATION ${install_dest} + ARCHIVE DESTINATION ${install_dest} + RUNTIME DESTINATION ${G_RUNTIME_OUTPUT_DIR} + INCLUDES + DESTINATION ${GRASS_INSTALL_INCLUDEDIR}) + + install( + EXPORT ${_libname}Targets + FILE GRASS_${_libname}Targets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GRASS + NAMESPACE GRASS:: + EXPORT_LINK_INTERFACE_LIBRARIES) + else() + install(TARGETS ${G_NAME} DESTINATION ${install_dest}) + endif() endfunction() diff --git a/cmake/modules/get_versions.cmake b/cmake/modules/get_versions.cmake index 3fdc8aefe25..5ddd4063c4d 100644 --- a/cmake/modules/get_versions.cmake +++ b/cmake/modules/get_versions.cmake @@ -6,10 +6,11 @@ COPYRIGHT: (C) 2020 by the GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later #]] -function(get_versions file_path var_major var_minor var_release var_date) +function(get_versions file_path var_major var_minor var_release var_suffix var_date) set(version_major 0) set(version_minor 0) set(version_release 0) + set(version_suffix "") set(version_date 00000000) file(STRINGS "${file_path}" grass_version_strings) list(LENGTH grass_version_strings grass_version_file_length) @@ -23,6 +24,8 @@ function(get_versions file_path var_major var_minor var_release var_date) if(grass_version_file_length GREATER 2) list(GET grass_version_strings 2 version_release) + string(REGEX REPLACE "(^[0-9]+)(.*)" "\\2" version_suffix ${version_release}) + string(REGEX MATCH "^[0-9]+" version_release ${version_release}) endif() if(grass_version_file_length GREATER 3) @@ -38,6 +41,9 @@ function(get_versions file_path var_major var_minor var_release var_date) set(${var_release} ${version_release} PARENT_SCOPE) + set(${var_suffix} + ${version_suffix} + PARENT_SCOPE) set(${var_date} ${version_date} PARENT_SCOPE) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index b20b2a4d815..4ea1df638dc 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -86,7 +86,7 @@ build_library_in_subdir( grass_driver grass_gis INCLUDES - "./driver") + "${CMAKE_CURRENT_SOURCE_DIR}/driver") add_custom_command( TARGET grass_psdriver POST_BUILD @@ -102,7 +102,7 @@ build_library_in_subdir( grass_gis grass_driver INCLUDES - "./driver") + "${CMAKE_CURRENT_SOURCE_DIR}/driver") set(_grass_display_DEFS) diff --git a/lib/db/CMakeLists.txt b/lib/db/CMakeLists.txt index fb61243b6f2..25bf7a0f241 100644 --- a/lib/db/CMakeLists.txt +++ b/lib/db/CMakeLists.txt @@ -1,7 +1,7 @@ -file(GLOB dbmibase_SRCS "./dbmi_base/*.c") +file(GLOB dbmibase_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/dbmi_base/*.c") if(MSVC) - set(dbmibase_INCLUDES "./dbmi_base" "../../msvc") - list(APPEND dbmibase_SRCS "../../msvc/dirent.c") + set(dbmibase_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/dbmi_base" "${CMAKE_SOURCE_DIR}/msvc") + list(APPEND dbmibase_SRCS "${CMAKE_SOURCE_DIR}/msvc/dirent.c") endif() build_library_in_subdir( @@ -25,7 +25,7 @@ build_library_in_subdir( grass_dbmibase grass_gis INCLUDES - "./dbmi_base") + "${CMAKE_CURRENT_SOURCE_DIR}/dbmi_base") build_library_in_subdir(stubs NAME grass_dbstubs DEPENDS grass_gis grass_dbmibase) @@ -39,6 +39,6 @@ build_library_in_subdir( grass_dbstubs grass_gis INCLUDES - "./dbmi_base") + "${CMAKE_CURRENT_SOURCE_DIR}/dbmi_base") add_subdirectory(sqlp) diff --git a/lib/proj/CMakeLists.txt b/lib/proj/CMakeLists.txt index 928c2b8d065..b7b3079293a 100644 --- a/lib/proj/CMakeLists.txt +++ b/lib/proj/CMakeLists.txt @@ -18,6 +18,6 @@ build_module( SOURCES "${grass_gproj_SOURCES}" INCLUDES - "../driver") + "${CMAKE_CURRENT_SOURCE_DIR}/../driver") target_include_directories(grass_gproj PUBLIC ${GDAL_INCLUDE_DIR} ${PROJ_INCLUDE_DIRS}) diff --git a/raster/r.sim/CMakeLists.txt b/raster/r.sim/CMakeLists.txt index e7450eae8b0..50b46e88e26 100644 --- a/raster/r.sim/CMakeLists.txt +++ b/raster/r.sim/CMakeLists.txt @@ -25,7 +25,7 @@ build_program_in_subdir( OPTIONAL_DEPENDS OPENMP INCLUDES - "../simlib") + "${CMAKE_CURRENT_SOURCE_DIR}/../simlib") build_program_in_subdir( r.sim.sediment @@ -38,4 +38,4 @@ build_program_in_subdir( OPTIONAL_DEPENDS OPENMP INCLUDES - "../simlib") + "${CMAKE_CURRENT_SOURCE_DIR}/../simlib") From 19517b0949e33c756f24ce054a14e87797aef8b1 Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Tue, 6 Jan 2026 18:05:26 +0100 Subject: [PATCH 2/4] missing piece from PR split --- cmake/modules/GRASSInstallDirs.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/GRASSInstallDirs.cmake b/cmake/modules/GRASSInstallDirs.cmake index ce40fc03c35..c12d2d2b2c5 100644 --- a/cmake/modules/GRASSInstallDirs.cmake +++ b/cmake/modules/GRASSInstallDirs.cmake @@ -54,6 +54,8 @@ else() set(GRASS_INSTALL_LOCALEDIR "${GISBASE_DIR}/locale") endif() +set(GRASS_INSTALL_CMAKECONFDIR "${CMAKE_INSTALL_LIBDIR}/cmake") + message(STATUS "GISBASE_DIR ${GISBASE_DIR}") message(STATUS "GRASS_INSTALL_BINDIR ${GRASS_INSTALL_BINDIR}") message(STATUS "GRASS_INSTALL_LIBDIR ${GRASS_INSTALL_LIBDIR}") @@ -76,6 +78,7 @@ message(STATUS "GRASS_INSTALL_DEMODIR ${GRASS_INSTALL_DEMODIR}") message(STATUS "GRASS_INSTALL_MISCDIR ${GRASS_INSTALL_MISCDIR}") message(STATUS "GRASS_INSTALL_MAKEFILEDIR ${GRASS_INSTALL_MAKEFILEDIR}") message(STATUS "GRASS_INSTALL_LOCALEDIR ${GRASS_INSTALL_LOCALEDIR}") +message(STATUS "GRASS_INSTALL_CMAKECONFDIR ${GRASS_INSTALL_CMAKECONFDIR}") set(OUTDIR "${CMAKE_BINARY_DIR}/output") set(GISBASE ${CMAKE_INSTALL_PREFIX}/${GISBASE_DIR}) From f2e301f71634cd2aab01ef43dfee6712d9fb2831 Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Mon, 12 Jan 2026 10:58:21 +0100 Subject: [PATCH 3/4] Use a general include_directories for third party include files' paths exposed in GRASS API, enabling linking core modules to GRASS libraries without adding unnecessary dependency targets. --- cmake/modules/CheckDependentLibraries.cmake | 8 ++++++++ lib/gis/CMakeLists.txt | 2 -- lib/proj/CMakeLists.txt | 2 -- lib/rst/CMakeLists.txt | 5 ----- lib/vector/CMakeLists.txt | 3 --- lib/vector/diglib/CMakeLists.txt | 4 ---- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/cmake/modules/CheckDependentLibraries.cmake b/cmake/modules/CheckDependentLibraries.cmake index ead57eeb99a..4f7fbf233ca 100644 --- a/cmake/modules/CheckDependentLibraries.cmake +++ b/cmake/modules/CheckDependentLibraries.cmake @@ -327,3 +327,11 @@ if(WITH_OPENGL) set(OPENGL_X11 1) endif() endif() + +# Workaround to make sure core modules linking to GRASS libraries find the way +# to thirdparty include files exposed in GRASS API, without the need to add +# dependency targets unnecessarily +set(_grass_lib_thirdparty_includes ${GDAL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${PROJ_INCLUDE_DIRS} ${PostgreSQL_INCLUDE_DIR}) +list(REMOVE_DUPLICATES _grass_lib_thirdparty_includes) +include_directories(${_grass_lib_thirdparty_includes}) +unset(_grass_lib_thirdparty_includes) diff --git a/lib/gis/CMakeLists.txt b/lib/gis/CMakeLists.txt index 711725b02b3..abc916e599c 100644 --- a/lib/gis/CMakeLists.txt +++ b/lib/gis/CMakeLists.txt @@ -75,8 +75,6 @@ install( DESTINATION ${GRASS_INSTALL_ETCDIR}/proj) install(FILES colors.desc renamed_options DESTINATION ${GRASS_INSTALL_ETCDIR}) -target_include_directories(grass_gis PUBLIC ${ZLIB_INCLUDE_DIR}) - if(UNIX) target_link_libraries(grass_gis PRIVATE ${LIBM}) endif() diff --git a/lib/proj/CMakeLists.txt b/lib/proj/CMakeLists.txt index b7b3079293a..9eff1f2ef90 100644 --- a/lib/proj/CMakeLists.txt +++ b/lib/proj/CMakeLists.txt @@ -19,5 +19,3 @@ build_module( "${grass_gproj_SOURCES}" INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/../driver") - -target_include_directories(grass_gproj PUBLIC ${GDAL_INCLUDE_DIR} ${PROJ_INCLUDE_DIRS}) diff --git a/lib/rst/CMakeLists.txt b/lib/rst/CMakeLists.txt index 32cdfc20823..790c8a03d6d 100644 --- a/lib/rst/CMakeLists.txt +++ b/lib/rst/CMakeLists.txt @@ -36,8 +36,3 @@ build_library_in_subdir( OPENMP HEADERS "interpf.h") - -target_include_directories(grass_interpfl PUBLIC ${GDAL_INCLUDE_DIR}) -if(TARGET PostgreSQL::PostgreSQL) - target_include_directories(grass_interpfl PUBLIC ${PostgreSQL_INCLUDE_DIR}) -endif() diff --git a/lib/vector/CMakeLists.txt b/lib/vector/CMakeLists.txt index 51bc2b3f2a0..d95d9895414 100644 --- a/lib/vector/CMakeLists.txt +++ b/lib/vector/CMakeLists.txt @@ -23,11 +23,8 @@ build_library_in_subdir( OPTIONAL_DEPENDS GEOS::geos_c) -target_include_directories(grass_vector PUBLIC ${GDAL_INCLUDE_DIR}) - if(TARGET PostgreSQL::PostgreSQL) target_link_libraries(grass_vector PRIVATE PostgreSQL::PostgreSQL) - target_include_directories(grass_vector PUBLIC ${PostgreSQL_INCLUDE_DIR}) endif() if(TARGET LAPACKE) diff --git a/lib/vector/diglib/CMakeLists.txt b/lib/vector/diglib/CMakeLists.txt index f238090d1e6..48e7e95e952 100644 --- a/lib/vector/diglib/CMakeLists.txt +++ b/lib/vector/diglib/CMakeLists.txt @@ -36,7 +36,3 @@ build_module( grass_rtree GDAL::GDAL ${LIBM}) - -if(TARGET PostgreSQL::PostgreSQL) - target_include_directories(grass_dig2 PUBLIC ${PostgreSQL_INCLUDE_DIR}) -endif() From d34c52655d863c9ec1f59d44e0ca542c7a8187c2 Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Mon, 12 Jan 2026 14:34:05 +0100 Subject: [PATCH 4/4] use generator expression to extract include dir from target --- cmake/modules/CheckDependentLibraries.cmake | 8 -------- lib/gis/CMakeLists.txt | 3 +++ lib/proj/CMakeLists.txt | 5 +++++ lib/rst/CMakeLists.txt | 8 ++++++++ lib/vector/CMakeLists.txt | 5 +++++ lib/vector/diglib/CMakeLists.txt | 5 +++++ 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/cmake/modules/CheckDependentLibraries.cmake b/cmake/modules/CheckDependentLibraries.cmake index 4f7fbf233ca..ead57eeb99a 100644 --- a/cmake/modules/CheckDependentLibraries.cmake +++ b/cmake/modules/CheckDependentLibraries.cmake @@ -327,11 +327,3 @@ if(WITH_OPENGL) set(OPENGL_X11 1) endif() endif() - -# Workaround to make sure core modules linking to GRASS libraries find the way -# to thirdparty include files exposed in GRASS API, without the need to add -# dependency targets unnecessarily -set(_grass_lib_thirdparty_includes ${GDAL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${PROJ_INCLUDE_DIRS} ${PostgreSQL_INCLUDE_DIR}) -list(REMOVE_DUPLICATES _grass_lib_thirdparty_includes) -include_directories(${_grass_lib_thirdparty_includes}) -unset(_grass_lib_thirdparty_includes) diff --git a/lib/gis/CMakeLists.txt b/lib/gis/CMakeLists.txt index abc916e599c..0ea06e97cb4 100644 --- a/lib/gis/CMakeLists.txt +++ b/lib/gis/CMakeLists.txt @@ -75,6 +75,9 @@ install( DESTINATION ${GRASS_INSTALL_ETCDIR}/proj) install(FILES colors.desc renamed_options DESTINATION ${GRASS_INSTALL_ETCDIR}) +target_include_directories(grass_gis + INTERFACE $) + if(UNIX) target_link_libraries(grass_gis PRIVATE ${LIBM}) endif() diff --git a/lib/proj/CMakeLists.txt b/lib/proj/CMakeLists.txt index 9eff1f2ef90..b306bf3b1f3 100644 --- a/lib/proj/CMakeLists.txt +++ b/lib/proj/CMakeLists.txt @@ -19,3 +19,8 @@ build_module( "${grass_gproj_SOURCES}" INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/../driver") + +target_include_directories(grass_gproj + INTERFACE $ + $/gdal + $) diff --git a/lib/rst/CMakeLists.txt b/lib/rst/CMakeLists.txt index 790c8a03d6d..1f3aece526c 100644 --- a/lib/rst/CMakeLists.txt +++ b/lib/rst/CMakeLists.txt @@ -36,3 +36,11 @@ build_library_in_subdir( OPENMP HEADERS "interpf.h") + +target_include_directories(grass_interpfl + INTERFACE $ + $/gdal) +if(TARGET PostgreSQL::PostgreSQL) + target_include_directories(grass_interpfl + INTERFACE $) +endif() diff --git a/lib/vector/CMakeLists.txt b/lib/vector/CMakeLists.txt index d95d9895414..159b148a5a2 100644 --- a/lib/vector/CMakeLists.txt +++ b/lib/vector/CMakeLists.txt @@ -23,8 +23,13 @@ build_library_in_subdir( OPTIONAL_DEPENDS GEOS::geos_c) +target_include_directories(grass_vector + INTERFACE $ + $/gdal) if(TARGET PostgreSQL::PostgreSQL) target_link_libraries(grass_vector PRIVATE PostgreSQL::PostgreSQL) + target_include_directories(grass_vector + INTERFACE $) endif() if(TARGET LAPACKE) diff --git a/lib/vector/diglib/CMakeLists.txt b/lib/vector/diglib/CMakeLists.txt index 48e7e95e952..f2bbae3090e 100644 --- a/lib/vector/diglib/CMakeLists.txt +++ b/lib/vector/diglib/CMakeLists.txt @@ -36,3 +36,8 @@ build_module( grass_rtree GDAL::GDAL ${LIBM}) + +if(TARGET PostgreSQL::PostgreSQL) + target_include_directories(grass_dig2 + PUBLIC $) +endif()