Skip to content

Commit

Permalink
Fix: ALIAS not globally visible targets with old cmake (#59752)
Browse files Browse the repository at this point in the history
* Fix: ALIAS not globally visible targets with old cmake

* Compatible with cmake3.18 version
  • Loading branch information
hxbb00 authored Dec 9, 2024
1 parent e9e7bc5 commit 6f7afaf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmake/FindSpatiaLite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ if(PkgConfig_FOUND)
endif()

if(PC_SPATIALITE_FOUND)
add_library(spatialite::spatialite ALIAS PkgConfig::PC_SPATIALITE)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
add_library(spatialite::spatialite ALIAS PkgConfig::PC_SPATIALITE)
else()
set(SPATIALITE_INCLUDE_DIR "${PC_SPATIALITE_INCLUDE_DIRS}" CACHE STRING "")
set(SPATIALITE_LIBRARY "${PC_SPATIALITE_LIBRARIES}" CACHE STRING "")
if(NOT TARGET spatialite::spatialite)
add_library(spatialite::spatialite INTERFACE IMPORTED)
set_target_properties(spatialite::spatialite PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_SPATIALITE)
endif()
endif()
set(SPATIALITE_FOUND TRUE)
else()
# Fallback for systems without PkgConfig, e.g. OSGeo4W
Expand Down

0 comments on commit 6f7afaf

Please sign in to comment.