diff options
author | Marvin W <git@larma.de> | 2018-03-28 12:25:28 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-28 12:25:28 -0600 |
commit | 105006c5f10e4c3cba7f0a6211215b07343e7c7d (patch) | |
tree | e153055d3f69493a7d68ff5f79a82da361ea22fd /cmake/FindGCrypt.cmake | |
parent | fefa28c4ef90eadb473d787a9c24d7ed890dbc4d (diff) | |
parent | 06c4a8ffd6f714045c3048651d7837d731c636a7 (diff) | |
download | dino-105006c5f10e4c3cba7f0a6211215b07343e7c7d.tar.gz dino-105006c5f10e4c3cba7f0a6211215b07343e7c7d.zip |
Merge pull request #220 from bochecha/pkgconfig
Find libraries with pkgconfig
Diffstat (limited to 'cmake/FindGCrypt.cmake')
-rw-r--r-- | cmake/FindGCrypt.cmake | 59 |
1 files changed, 5 insertions, 54 deletions
diff --git a/cmake/FindGCrypt.cmake b/cmake/FindGCrypt.cmake index 250f90c9..94c4c3f4 100644 --- a/cmake/FindGCrypt.cmake +++ b/cmake/FindGCrypt.cmake @@ -1,57 +1,8 @@ -set(GCrypt_PKG_CONFIG_NAME gcrypt) - -find_program(GCrypt_CONFIG_EXECUTABLE NAMES libgcrypt-config) -mark_as_advanced(GCrypt_CONFIG_EXECUTABLE) -find_program(GCrypt_SH_EXECUTABLE NAMES sh) -mark_as_advanced(GCrypt_SH_EXECUTABLE) - - -if(GCrypt_CONFIG_EXECUTABLE) - macro(gcrypt_config_fail errcode) - if(${errcode}) - message(FATAL_ERROR "Error invoking libgcrypt-config: ${errcode}") - endif(${errcode}) - endmacro(gcrypt_config_fail) - file(TO_NATIVE_PATH "${GCrypt_CONFIG_EXECUTABLE}" GCrypt_CONFIG_EXECUTABLE) - file(TO_NATIVE_PATH "${GCrypt_SH_EXECUTABLE}" GCrypt_SH_EXECUTABLE) - - execute_process(COMMAND "${GCrypt_SH_EXECUTABLE}" "${GCrypt_CONFIG_EXECUTABLE}" --version - OUTPUT_VARIABLE GCrypt_VERSION - RESULT_VARIABLE ERRCODE - OUTPUT_STRIP_TRAILING_WHITESPACE) - gcrypt_config_fail(${ERRCODE}) - - execute_process(COMMAND "${GCrypt_SH_EXECUTABLE}" "${GCrypt_CONFIG_EXECUTABLE}" --api-version - OUTPUT_VARIABLE GCrypt_API_VERSION - RESULT_VARIABLE ERRCODE - OUTPUT_STRIP_TRAILING_WHITESPACE) - gcrypt_config_fail(${ERRCODE}) - - execute_process(COMMAND "${GCrypt_SH_EXECUTABLE}" "${GCrypt_CONFIG_EXECUTABLE}" --cflags - OUTPUT_VARIABLE GCrypt_CFLAGS - RESULT_VARIABLE ERRCODE - OUTPUT_STRIP_TRAILING_WHITESPACE) - gcrypt_config_fail(${ERRCODE}) - - execute_process(COMMAND "${GCrypt_SH_EXECUTABLE}" "${GCrypt_CONFIG_EXECUTABLE}" --libs - OUTPUT_VARIABLE GCrypt_LDFLAGS - RESULT_VARIABLE ERRCODE - OUTPUT_STRIP_TRAILING_WHITESPACE) - gcrypt_config_fail(${ERRCODE}) - - string(REGEX REPLACE "^(.* |)-l([^ ]*gcrypt[^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY_NAME "${GCrypt_LDFLAGS}") - string(REGEX REPLACE "^(.* |)-L([^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY_DIRS "${GCrypt_LDFLAGS}") - find_library(GCrypt_LIBRARY ${GCrypt_LIBRARY_NAME} HINTS ${GCrypt_LIBRARY_DIRS}) - mark_as_advanced(GCrypt_LIBRARY) - unset(GCrypt_LIBRARY_NAME) - unset(GCrypt_LIBRARY_DIRS) - - if(NOT TARGET gcrypt) - add_library(gcrypt INTERFACE IMPORTED) - set_property(TARGET gcrypt PROPERTY INTERFACE_LINK_LIBRARIES "${GCrypt_LDFLAGS}") - set_property(TARGET gcrypt PROPERTY INTERFACE_COMPILE_OPTIONS "${GCrypt_CFLAGS}") - endif(NOT TARGET gcrypt) -endif(GCrypt_CONFIG_EXECUTABLE) +include(PkgConfigWithFallbackOnConfigScript) +find_pkg_config_with_fallback_on_config_script(GCrypt + PKG_CONFIG_NAME libgcrypt + CONFIG_SCRIPT_NAME libgcrypt +) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GCrypt |