From 1c77f995e27b606fe6ac52f5e3ebf5092d0b6c61 Mon Sep 17 00:00:00 2001 From: Torsten Wierschin Date: Fri, 9 Oct 2026 14:21:36 +0000 Subject: [PATCH] Fix GeographicLib linking: use TARGET_LINK_LIBRARIES directly and add LINK_DIRECTORIES - Changed from NGL_TARGET_LINK_LIBRARIES to TARGET_LINK_LIBRARIES for GeographicLib - Added TARGET_LINK_DIRECTORIES to ensure linker finds the library - Applied to LtsCoordTrans library, tools, and test executable Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Lts/Common/LtsCoordTrans/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsCoordTrans/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsCoordTrans/CMakeLists.txt index 519b4d954..7e888079f 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsCoordTrans/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsCoordTrans/CMakeLists.txt @@ -23,10 +23,11 @@ NGL_TARGET_LINK_LIBRARIES(LtsCoordTrans Qt6::Core ) if (GeographicLib_FOUND) - NGL_TARGET_LINK_LIBRARIES(LtsCoordTrans + TARGET_LINK_LIBRARIES(LtsCoordTrans PRIVATE ${GeographicLib_LIBRARIES} ) TARGET_INCLUDE_DIRECTORIES(LtsCoordTrans PRIVATE ${GeographicLib_INCLUDE_DIRS}) + TARGET_LINK_DIRECTORIES(LtsCoordTrans PRIVATE ${GeographicLib_LIBRARY_DIRS}) else() message(STATUS "GeographicLib not found; building LtsCoordTrans without it") endif() @@ -67,11 +68,12 @@ IF(TARGET LtsCoordTrans) SET(_tools lonlat2mgrs mgrs2lonlat) FOREACH(_tool ${_tools}) NGL_ADD_EXECUTABLE(ALL ${_tool} ${_tool}.cpp) - NGL_TARGET_LINK_LIBRARIES(${_tool} + TARGET_LINK_LIBRARIES(${_tool} Qt6::Core ${GeographicLib_LIBRARIES} ) TARGET_INCLUDE_DIRECTORIES(${_tool} PRIVATE ${GeographicLib_INCLUDE_DIRS}) + TARGET_LINK_DIRECTORIES(${_tool} PRIVATE ${GeographicLib_LIBRARY_DIRS}) NGL_INSTALL_TARGET(${_tool}) ENDFOREACH() ENDIF() @@ -95,5 +97,8 @@ IF(BUILD_TESTING AND TARGET LtsCoordTrans) ${GeographicLib_LIBRARIES} ) TARGET_INCLUDE_DIRECTORIES(lts_coord_trans_unit_test PRIVATE ${GeographicLib_INCLUDE_DIRS}) + if (GeographicLib_FOUND) + TARGET_LINK_DIRECTORIES(lts_coord_trans_unit_test PRIVATE ${GeographicLib_LIBRARY_DIRS}) + endif() ADD_TEST(NAME lts_coord_trans_unit_test COMMAND $) ENDIF()