--- a/CMake/FindLIBPROJ4.cmake Thu Aug 10 21:03:55 2017 +++ b/CMake/FindLIBPROJ4.cmake Thu Aug 10 21:08:58 2017 @@ -11,7 +11,7 @@ file( TO_CMAKE_PATH "$ENV{LIBPROJ4_DIR}" _LIBPROJ4_DIR ) endif () - find_library( LIBPROJ4_LIBRARIES + find_library( LIBPROJ4_LIBRARY_RELEASE NAMES proj PATHS ${_LIBPROJ4_DIR}/lib64 @@ -24,7 +24,21 @@ ${CMAKE_INSTALL_PREFIX}/lib /usr/local/lib /usr/lib - NO_DEFAULT_PATH + ) + + find_library( LIBPROJ4_LIBRARY_DEBUG + NAMES projd + PATHS + ${_LIBPROJ4_DIR}/lib64 + ${CMAKE_INSTALL_PREFIX}/lib64 + /usr/local/lib64 + /usr/lib64 + ${_LIBPROJ4_DIR} + ${_LIBPROJ4_DIR}/lib + ${CMAKE_INSTALL_PREFIX}/bin + ${CMAKE_INSTALL_PREFIX}/lib + /usr/local/lib + /usr/lib ) find_path( LIBPROJ4_INCLUDE_DIR @@ -37,19 +51,22 @@ /usr/local/include /usr/include /usr/include/postgresql - NO_DEFAULT_PATH ) - if ( NOT LIBPROJ4_INCLUDE_DIR OR NOT LIBPROJ4_LIBRARIES ) - if ( LIBPROJ4_REQUIRED ) - message( FATAL_ERROR "LIBPROJ4 is required. Set LIBPROJ4_DIR" ) - endif () - else () - set( LIBPROJ4_FOUND 1 ) - mark_as_advanced( LIBPROJ4_FOUND ) - endif () + include(SelectLibraryConfigurations) + select_library_configurations(LIBPROJ4) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(LIBPROJ4 + REQUIRED_VARS LIBPROJ4_LIBRARY LIBPROJ4_INCLUDE_DIR) + + if(LIBPROJ4_FOUND) + set(LIBPROJ4_INCLUDE_DIRS ${LIBPROJ4_INCLUDE_DIR}) + if(NOT LIBPROJ4_LIBRARIES) + set(LIBPROJ4_LIBRARIES ${LIBPROJ4_LIBRARY}) + endif() + endif() endif () -mark_as_advanced( FORCE LIBPROJ4_INCLUDE_DIR ) -mark_as_advanced( FORCE LIBPROJ4_LIBRARIES ) +mark_as_advanced(LIBPROJ4_INCLUDE_DIR)