Skip to content

Commit

Permalink
[cmake/FindGEOS] Add FindPackageHandleStandardArgs fallback if GEOS n…
Browse files Browse the repository at this point in the history
…ot found (#1977)

This should make the module slightly more user-friendly by correctly
handling explicit specification of GEOS_INCLUDE_DIR and GEOS_LIBRARY.
  • Loading branch information
mloskot authored and hobu committed Apr 26, 2018
1 parent c1d9895 commit 117fdaf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmake/modules/FindGEOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,19 @@ IF (GEOS_INCLUDE_DIR AND GEOS_LIBRARY)
SET(GEOS_FOUND TRUE)
ENDIF (GEOS_INCLUDE_DIR AND GEOS_LIBRARY)

if (NOT GEOS_INCLUDE_DIR OR NOT GEOS_LIBRARY)
include(SelectLibraryConfigurations)
select_library_configurations(GEOS)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GEOS REQUIRED_VARS GEOS_LIBRARY GEOS_INCLUDE_DIR)
if(GEOS_FOUND)
set(GEOS_INCLUDE_DIRS ${GEOS_INCLUDE_DIR})
if(NOT GEOS_LIBRARIES)
set(GEOS_LIBRARIES ${GEOS_LIBRARY})
endif()
endif()
endif()

IF (GEOS_FOUND)

IF (NOT GEOS_FIND_QUIETLY)
Expand Down

1 comment on commit 117fdaf

@abellgithub
Copy link
Contributor

@abellgithub abellgithub commented on 117fdaf Apr 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the point of this. If we're trying to provide an override option, we usually do this in options.cmake and in <module>.cmake.

Please sign in to comment.