diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2021-02-10 20:19:19 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2021-02-11 14:46:10 (GMT) |
commit | 3caaff4c080ce20aa44810f4c033a1cc551ccab7 (patch) | |
tree | e6a61e693a3a1903173d5e8666dbabf81b6b87fc /Modules/FindGDAL.cmake | |
parent | 3f6a4f2062f998512da619a0bd318f11c931f508 (diff) | |
download | CMake-3caaff4c080ce20aa44810f4c033a1cc551ccab7.zip CMake-3caaff4c080ce20aa44810f4c033a1cc551ccab7.tar.gz CMake-3caaff4c080ce20aa44810f4c033a1cc551ccab7.tar.bz2 |
FindGDAL: conditionally set the output variables
Diffstat (limited to 'Modules/FindGDAL.cmake')
-rw-r--r-- | Modules/FindGDAL.cmake | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index e2c9514..140504c 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -160,12 +160,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL VERSION_VAR GDAL_VERSION REQUIRED_VARS GDAL_LIBRARY GDAL_INCLUDE_DIR) -if (GDAL_FOUND AND NOT TARGET GDAL::GDAL) - add_library(GDAL::GDAL UNKNOWN IMPORTED) - set_target_properties(GDAL::GDAL PROPERTIES - IMPORTED_LOCATION "${GDAL_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${GDAL_INCLUDE_DIR}") +if (GDAL_FOUND) + set(GDAL_LIBRARIES ${GDAL_LIBRARY}) + set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR}) + + if (NOT TARGET GDAL::GDAL) + add_library(GDAL::GDAL UNKNOWN IMPORTED) + set_target_properties(GDAL::GDAL PROPERTIES + IMPORTED_LOCATION "${GDAL_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GDAL_INCLUDE_DIR}") + endif () endif () - -set(GDAL_LIBRARIES ${GDAL_LIBRARY}) -set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR}) |