From 5faab0199a35e0ba9fb92345161d125615bf5e61 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Sat, 20 Jan 2024 16:11:02 +0000 Subject: [PATCH 1/2] Be louder when graphics is missing for geospatial Signed-off-by: Michael Carroll --- geospatial/src/CMakeLists.txt | 45 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/geospatial/src/CMakeLists.txt b/geospatial/src/CMakeLists.txt index f9fdcedc8..bf528bee7 100644 --- a/geospatial/src/CMakeLists.txt +++ b/geospatial/src/CMakeLists.txt @@ -1,24 +1,27 @@ -gz_get_libsources_and_unittests(sources gtest_sources) +if (TARGET ${PROJECT_LIBRARY_TARGET_NAME}-graphics) + gz_get_libsources_and_unittests(sources gtest_sources) + gz_add_component(geospatial + SOURCES ${sources} + DEPENDS_ON_COMPONENTS graphics + GET_TARGET_NAME geospatial_target) -gz_add_component(geospatial - SOURCES ${sources} - DEPENDS_ON_COMPONENTS graphics - GET_TARGET_NAME geospatial_target) + target_link_libraries(${geospatial_target} + PUBLIC + ${PROJECT_LIBRARY_TARGET_NAME}-graphics + gz-math${GZ_MATH_VER}::gz-math${GZ_MATH_VER} + gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER} + PRIVATE + ${GDAL_LIBRARY}) -target_link_libraries(${geospatial_target} - PUBLIC - ${PROJECT_LIBRARY_TARGET_NAME}-graphics - gz-math${GZ_MATH_VER}::gz-math${GZ_MATH_VER} - gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER} - PRIVATE - ${GDAL_LIBRARY}) + target_include_directories(${geospatial_target} + PRIVATE + ${GDAL_INCLUDE_DIR}) -target_include_directories(${geospatial_target} - PRIVATE - ${GDAL_INCLUDE_DIR}) - -gz_build_tests(TYPE UNIT SOURCES ${gtest_sources} - LIB_DEPS - ${geospatial_target} - gz-common${GZ_COMMON_VER}-testing -) + gz_build_tests(TYPE UNIT SOURCES ${gtest_sources} + LIB_DEPS + ${geospatial_target} + gz-common${GZ_COMMON_VER}-testing + ) +else() + message(WARNING "Skipping component [geospatial]: Missing component [graphics].\n ^~~~~ Set SKIP_geospatial=true in cmake to suppress this warning.") +endif() From 1981c0490cb6303e6339ff90408169e0506add88 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Mon, 29 Jan 2024 15:55:28 +0000 Subject: [PATCH 2/2] Change component order Signed-off-by: Michael Carroll --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 402352a42..b7697c738 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,7 +138,7 @@ configure_file("${PROJECT_SOURCE_DIR}/cppcheck.suppress.in" ${PROJECT_BINARY_DIR}/cppcheck.suppress) gz_configure_build(QUIT_IF_BUILD_ERRORS - COMPONENTS av events geospatial graphics io profiler testing) + COMPONENTS av events graphics geospatial io profiler testing) #============================================================================ # Create package information