Commit 3caaff4c authored by Ben Boeckel's avatar Ben Boeckel
Browse files

FindGDAL: conditionally set the output variables

parent 3f6a4f20
...@@ -160,12 +160,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL ...@@ -160,12 +160,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL
VERSION_VAR GDAL_VERSION VERSION_VAR GDAL_VERSION
REQUIRED_VARS GDAL_LIBRARY GDAL_INCLUDE_DIR) REQUIRED_VARS GDAL_LIBRARY GDAL_INCLUDE_DIR)
if (GDAL_FOUND AND NOT TARGET GDAL::GDAL) if (GDAL_FOUND)
add_library(GDAL::GDAL UNKNOWN IMPORTED) set(GDAL_LIBRARIES ${GDAL_LIBRARY})
set_target_properties(GDAL::GDAL PROPERTIES set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
IMPORTED_LOCATION "${GDAL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${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 () endif ()
set(GDAL_LIBRARIES ${GDAL_LIBRARY})
set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment