Find Gcrypt: Reformat CMake code
-
+# ~~~
# - Try to find the Gcrypt library
# Once run this will define
#
#
# LIBGCRYPT_INCLUDE_DIR - set to the path where gcrypt's include files are stored
# HAS_GCRYPT_4SURE - set if a sample program can be compiled and linked against libgcrypt
-#
+# ~~~
# search in typical paths for libgcrypt-config
-FIND_PROGRAM(LIBGCRYPTCONFIG_EXECUTABLE NAMES libgcrypt-config)
+find_program (LIBGCRYPTCONFIG_EXECUTABLE NAMES libgcrypt-config)
# reset variables
set (LIBGCRYPT_LIBRARIES)
set (LIBGCRYPT_CFLAGS)
# if libgcrypt-config has been found
-IF(LIBGCRYPTCONFIG_EXECUTABLE)
+if (LIBGCRYPTCONFIG_EXECUTABLE)
# workaround for MinGW/MSYS
# CMake can't starts shell scripts on windows so it need to use sh.exe
- EXECUTE_PROCESS(COMMAND sh ${LIBGCRYPTCONFIG_EXECUTABLE} --libs RESULT_VARIABLE _return_VALUE OUTPUT_VARIABLE LIBGCRYPT_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
- EXECUTE_PROCESS(COMMAND sh ${LIBGCRYPTCONFIG_EXECUTABLE} --cflags RESULT_VARIABLE _return_VALUE OUTPUT_VARIABLE LIBGCRYPT_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process (COMMAND sh ${LIBGCRYPTCONFIG_EXECUTABLE} --libs
+ RESULT_VARIABLE _return_VALUE
+ OUTPUT_VARIABLE LIBGCRYPT_LIBRARIES
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process (COMMAND sh ${LIBGCRYPTCONFIG_EXECUTABLE} --cflags
+ RESULT_VARIABLE _return_VALUE
+ OUTPUT_VARIABLE LIBGCRYPT_CFLAGS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
- IF(NOT LIBGCRYPT_CFLAGS AND NOT _return_VALUE)
- SET(LIBGCRYPT_CFLAGS " ")
- ENDIF(NOT LIBGCRYPT_CFLAGS AND NOT _return_VALUE)
+ if (NOT LIBGCRYPT_CFLAGS AND NOT _return_VALUE)
+ set (LIBGCRYPT_CFLAGS " ")
+ endif (NOT LIBGCRYPT_CFLAGS AND NOT _return_VALUE)
- IF(LIBGCRYPT_LIBRARIES AND LIBGCRYPT_CFLAGS)
- SET(LIBGCRYPT_FOUND TRUE)
- ENDIF(LIBGCRYPT_LIBRARIES AND LIBGCRYPT_CFLAGS)
+ if (LIBGCRYPT_LIBRARIES AND LIBGCRYPT_CFLAGS)
+ set (LIBGCRYPT_FOUND TRUE)
+ endif (LIBGCRYPT_LIBRARIES AND LIBGCRYPT_CFLAGS)
-ENDIF(LIBGCRYPTCONFIG_EXECUTABLE)
+endif (LIBGCRYPTCONFIG_EXECUTABLE)
if (LIBGCRYPT_FOUND)
if (NOT LibGcrypt_FIND_QUIETLY)
@@ -61,10 +67,8 @@ if (LIBGCRYPT_FOUND)
try_compile (HAS_GCRYPT_4SURE
"${CMAKE_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/src/plugins/crypto/compile_gcrypt.c"
- CMAKE_FLAGS
- -DINCLUDE_DIRECTORIES:STRING=${LIBGCRYPT_INCLUDE_DIR}
- -DLINK_LIBRARIES:PATH=${LIBGCRYPT_LIBRARIES}
- )
+ CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${LIBGCRYPT_INCLUDE_DIR}
+ -DLINK_LIBRARIES:PATH=${LIBGCRYPT_LIBRARIES})
if (NOT HAS_GCRYPT_4SURE)
message (STATUS "libgcrypt compile/linker test failed. Please check if all library and include paths are set properly!")
@@ -80,4 +84,4 @@ else (LIBGCRYPT_FOUND)
endif (LibGcrypt_FIND_REQUIRED)
endif (LIBGCRYPT_FOUND)
-MARK_AS_ADVANCED(LIBGCRYPT_CFLAGS LIBGCRYPT_LIBRARIES)
+mark_as_advanced (LIBGCRYPT_CFLAGS LIBGCRYPT_LIBRARIES)
