diff options
Diffstat (limited to 'cmake/FindGPGME.cmake')
-rw-r--r-- | cmake/FindGPGME.cmake | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cmake/FindGPGME.cmake b/cmake/FindGPGME.cmake index fd096363..90f734fe 100644 --- a/cmake/FindGPGME.cmake +++ b/cmake/FindGPGME.cmake @@ -1,4 +1,4 @@ -# TODO: Windows related stuff +set(GPGME_PKG_CONFIG_NAME gpgme) find_program(GPGME_CONFIG_EXECUTABLE NAMES gpgme-config) mark_as_advanced(GPGME_CONFIG_EXECUTABLE) @@ -17,11 +17,22 @@ if(GPGME_CONFIG_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${GPGME_CONFIG_EXECUTABLE} --libs - OUTPUT_VARIABLE GPGME_LIBRARIES + OUTPUT_VARIABLE GPGME_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(REGEX REPLACE "^(.* |)-l([^ ]*)$( .*|)" "\\2" GPGME_LIBRARY "${GPGME_LDFLAGS}") + string(REGEX REPLACE "^(.* |)-L([^ ]*)$( .*|)" "\\2" GPGME_LIBRARY_DIRS "${GPGME_LDFLAGS}") + find_library(LIB_NAME_GPGME ${GPGME_LIBRARY} HINTS ${GPGME_LIBRARY_DIRS}) + set(GPGME_LIBRARY ${LIB_NAME_GPGME}) + + if(NOT TARGET gpgme) + add_library(gpgme SHARED IMPORTED) + set_property(TARGET gpgme PROPERTY IMPORTED_LOCATION "${GPGME_LIBRARY}") + set_property(TARGET gpgme PROPERTY INTERFACE_COMPILE_OPTIONS "${GPGME_CFLAGS}") + endif(NOT TARGET gpgme) endif(GPGME_CONFIG_EXECUTABLE) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GPGME - REQUIRED_VARS GPGME_CONFIG_EXECUTABLE + REQUIRED_VARS GPGME_LIBRARY VERSION_VAR GPGME_VERSION)
\ No newline at end of file |