Przeglądaj źródła

Resolve #9685: Fix include dir to be correct path

Also refrain from setting _LIBRARIES & _INCLUDE_DIRS if lib not found (seems to be mostly standard practice).
Philip Lowman 16 lat temu
rodzic
commit
d5dd8f126d
1 zmienionych plików z 7 dodań i 6 usunięć
  1. 7 6
      Modules/FindGnuTLS.cmake

+ 7 - 6
Modules/FindGnuTLS.cmake

@@ -40,11 +40,10 @@ IF (NOT WIN32)
    SET(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
 ENDIF (NOT WIN32)
 
-FIND_PATH(GNUTLS_INCLUDE_DIR gnutls.h
+FIND_PATH(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
    HINTS
    ${PC_GNUTLS_INCLUDEDIR}
    ${PC_GNUTLS_INCLUDE_DIRS}
-   PATH_SUFFIXES gnutls
    )
 
 FIND_LIBRARY(GNUTLS_LIBRARY NAMES gnutls libgnutls
@@ -53,13 +52,15 @@ FIND_LIBRARY(GNUTLS_LIBRARY NAMES gnutls libgnutls
    ${PC_GNUTLS_LIBRARY_DIRS}
    )
 
+MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
+
 # handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if 
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
 
-MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
-
-SET(GNUTLS_LIBRARIES    ${GNUTLS_LIBRARY})
-SET(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
+IF(GNUTLS_FOUND)
+    SET(GNUTLS_LIBRARIES    ${GNUTLS_LIBRARY})
+    SET(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
+ENDIF()