Modernize cmake a bit: Remove confusing else and endif text

This commit is contained in:
Albert Astals Cid 2020-02-15 11:00:57 +01:00
parent ad1b9e1b07
commit f944220634
14 changed files with 94 additions and 96 deletions

View File

@ -4,7 +4,7 @@ if(NOT CMAKE_INSTALL_PREFIX)
set(QCA_INSTALL_IN_QT_PREFIX ON) set(QCA_INSTALL_IN_QT_PREFIX ON)
# If CMAKE_INSTALL_PREFIX is set in cmake arguments # If CMAKE_INSTALL_PREFIX is set in cmake arguments
unset(CMAKE_INSTALL_PREFIX CACHE) unset(CMAKE_INSTALL_PREFIX CACHE)
endif(NOT CMAKE_INSTALL_PREFIX) endif()
# The cmake min. version should be set before calling project(...) too # The cmake min. version should be set before calling project(...) too
cmake_minimum_required(VERSION 3.4) cmake_minimum_required(VERSION 3.4)
@ -37,7 +37,7 @@ find_package(Doxygen)
string(TOLOWER "${BUILD_PLUGINS}" BUILD_PLUGINS) string(TOLOWER "${BUILD_PLUGINS}" BUILD_PLUGINS)
if(NOT BUILD_PLUGINS) if(NOT BUILD_PLUGINS)
set(BUILD_PLUGINS "none") set(BUILD_PLUGINS "none")
endif(NOT BUILD_PLUGINS) endif()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
@ -59,9 +59,9 @@ if(NOT BUILD_SHARED_LIBS OR QT_IS_STATIC)
set(STATIC_PLUGINS ON) set(STATIC_PLUGINS ON)
add_definitions(-DQT_STATICPLUGIN) add_definitions(-DQT_STATICPLUGIN)
set(PLUGIN_TYPE "STATIC") set(PLUGIN_TYPE "STATIC")
else(NOT BUILD_SHARED_LIBS OR QT_IS_STATIC) else()
set(PLUGIN_TYPE "MODULE") set(PLUGIN_TYPE "MODULE")
endif(NOT BUILD_SHARED_LIBS OR QT_IS_STATIC) endif()
set(QCA_SUFFIX "${QCA_SUFFIX}" CACHE STRING "QCA common suffix") set(QCA_SUFFIX "${QCA_SUFFIX}" CACHE STRING "QCA common suffix")
if(QCA_SUFFIX) if(QCA_SUFFIX)
@ -70,13 +70,13 @@ if(QCA_SUFFIX)
set(MOZCERTS_NAME mozcerts-${QCA_SUFFIX}) set(MOZCERTS_NAME mozcerts-${QCA_SUFFIX})
set(QCA_PC_NAME qca2-${QCA_SUFFIX}.pc) set(QCA_PC_NAME qca2-${QCA_SUFFIX}.pc)
set(QCA_CONFIG_NAME_BASE "Qca-${QCA_SUFFIX}") set(QCA_CONFIG_NAME_BASE "Qca-${QCA_SUFFIX}")
else(QCA_SUFFIX) else()
set(QCA_LIB_NAME qca) set(QCA_LIB_NAME qca)
set(QCA_TOOL_NAME qcatool) set(QCA_TOOL_NAME qcatool)
set(MOZCERTS_NAME mozcerts) set(MOZCERTS_NAME mozcerts)
set(QCA_PC_NAME qca2.pc) set(QCA_PC_NAME qca2.pc)
set(QCA_CONFIG_NAME_BASE "Qca") set(QCA_CONFIG_NAME_BASE "Qca")
endif(QCA_SUFFIX) endif()
set(QCA_LIB_VERSION_STRING "${QCA_LIB_MAJOR_VERSION}.${QCA_LIB_MINOR_VERSION}.${QCA_LIB_PATCH_VERSION}") set(QCA_LIB_VERSION_STRING "${QCA_LIB_MAJOR_VERSION}.${QCA_LIB_MINOR_VERSION}.${QCA_LIB_PATCH_VERSION}")
@ -87,7 +87,7 @@ if (WIN32)
add_definitions(-DWIN32_LEAN_AND_MEAN) add_definitions(-DWIN32_LEAN_AND_MEAN)
elseif (APPLE) elseif (APPLE)
set(CMAKE_DEBUG_POSTFIX "_debug") set(CMAKE_DEBUG_POSTFIX "_debug")
endif (WIN32) endif()
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
if (CMAKE_SYSTEM_NAME MATCHES Linux) if (CMAKE_SYSTEM_NAME MATCHES Linux)
@ -100,8 +100,8 @@ if (CMAKE_COMPILER_IS_GNUCXX)
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -Wundef -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -Wundef -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-check-new -fno-common -Wsuggest-override") set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-check-new -fno-common -Wsuggest-override")
endif (CMAKE_SYSTEM_NAME MATCHES Linux) endif()
endif (CMAKE_COMPILER_IS_GNUCXX) endif()
add_definitions(-DQT_NO_CAST_TO_ASCII add_definitions(-DQT_NO_CAST_TO_ASCII
-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_ASCII
@ -165,7 +165,7 @@ if( QCA_INSTALL_IN_QT_PREFIX )
endif() endif()
set(QCA_DOC_INSTALL_DIR "${QT_DOC_DIR}/html/qca/" CACHE PATH "Directory where qca documentation will install") set(QCA_DOC_INSTALL_DIR "${QT_DOC_DIR}/html/qca/" CACHE PATH "Directory where qca documentation will install")
set(QCA_MAN_INSTALL_DIR "${QT_DATA_DIR}/man" CACHE PATH "Directory where qca man pages will install") set(QCA_MAN_INSTALL_DIR "${QT_DATA_DIR}/man" CACHE PATH "Directory where qca man pages will install")
else( QCA_INSTALL_IN_QT_PREFIX ) else()
# Cmake says nothing about LIB_SUFFIX # Cmake says nothing about LIB_SUFFIX
# de facto it is a standard way to specify lib suffix on many distros # de facto it is a standard way to specify lib suffix on many distros
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
@ -185,7 +185,7 @@ else( QCA_INSTALL_IN_QT_PREFIX )
endif() endif()
set(QCA_DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${QCA_LIB_NAME}/html" CACHE PATH "Directory where qca documentation will install") set(QCA_DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${QCA_LIB_NAME}/html" CACHE PATH "Directory where qca documentation will install")
set(QCA_MAN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Directory where qca man pages will install") set(QCA_MAN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Directory where qca man pages will install")
endif( QCA_INSTALL_IN_QT_PREFIX ) endif()
set(PKGCONFIG_INSTALL_PREFIX "${QCA_LIBRARY_INSTALL_DIR}/pkgconfig" CACHE PATH "Base directory for pkgconfig files") set(PKGCONFIG_INSTALL_PREFIX "${QCA_LIBRARY_INSTALL_DIR}/pkgconfig" CACHE PATH "Base directory for pkgconfig files")
@ -234,7 +234,7 @@ if(NOT WIN32)
if(NOT DEVELOPER_MODE) if(NOT DEVELOPER_MODE)
install(FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pkgconfig/${QCA_PC_NAME}" DESTINATION ${PKGCONFIG_INSTALL_PREFIX}) install(FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pkgconfig/${QCA_PC_NAME}" DESTINATION ${PKGCONFIG_INSTALL_PREFIX})
endif() endif()
endif(NOT WIN32) endif()
# strip CMAKE_INSTALL_PREFIX in all paths # strip CMAKE_INSTALL_PREFIX in all paths
if(USE_RELATIVE_PATHS) if(USE_RELATIVE_PATHS)
@ -270,20 +270,18 @@ endif()
if (APPLE) if (APPLE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif (APPLE) endif()
message(STATUS "Checking for certstore..") message(STATUS "Checking for certstore..")
# fixme add OR mac # fixme add OR mac
if( WIN32 ) if( WIN32 )
# USE BUILTIN # USE BUILTIN
else ( WIN32 ) else()
if ( DEFINED ENV{QC_CERTSTORE_PATH} ) if ( DEFINED ENV{QC_CERTSTORE_PATH} )
if(EXISTS $ENV{QC_CERTSTORE_PATH}) if(EXISTS $ENV{QC_CERTSTORE_PATH})
set( qca_CERTSTORE $ENV{QC_CERTSTORE_PATH}) set( qca_CERTSTORE $ENV{QC_CERTSTORE_PATH})
else(EXISTS $ENV{QC_CERTSTORE_PATH}) endif()
# path to try else()
endif(EXISTS $ENV{QC_CERTSTORE_PATH})
else( DEFINED ENV{QC_CERTSTORE_PATH} )
set( toTry set( toTry
"/etc/ssl/certs/ca-certificates.crt" "/etc/ssl/certs/ca-certificates.crt"
"/usr/share/ssl/cert.pem" "/usr/share/ssl/cert.pem"
@ -295,21 +293,21 @@ else ( WIN32 )
foreach (_current_try ${toTry}) foreach (_current_try ${toTry})
if(EXISTS ${_current_try}) if(EXISTS ${_current_try})
set( qca_CERTSTORE ${_current_try}) set( qca_CERTSTORE ${_current_try})
endif(EXISTS ${_current_try}) endif()
endforeach (_current_try) endforeach (_current_try)
endif( DEFINED ENV{QC_CERTSTORE_PATH} ) endif()
endif(WIN32) endif()
if (qca_CERTSTORE) if (qca_CERTSTORE)
message(STATUS "Found system certstore") message(STATUS "Found system certstore")
else (qca_CERTSTORE) else()
message(STATUS "Using built in certstore.") message(STATUS "Using built in certstore.")
set( qca_CERTSTORE "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem") set( qca_CERTSTORE "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem")
# note that INSTALL_FILES targets are relative to the current installation prefix... # note that INSTALL_FILES targets are relative to the current installation prefix...
if(NOT DEVELOPER_MODE) if(NOT DEVELOPER_MODE)
install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/certs") install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/certs")
endif() endif()
endif (qca_CERTSTORE) endif()
message(STATUS "certstore path: " ${qca_CERTSTORE}) message(STATUS "certstore path: " ${qca_CERTSTORE})
add_definitions( -DQCA_SYSTEMSTORE_PATH="${qca_CERTSTORE}" ) add_definitions( -DQCA_SYSTEMSTORE_PATH="${qca_CERTSTORE}" )
@ -361,18 +359,18 @@ if(STATIC_PLUGINS)
if(WITH_${PLUGIN}_PLUGIN_INTERNAL) if(WITH_${PLUGIN}_PLUGIN_INTERNAL)
string(REPLACE "-" "_" IMPORT_NAME "qca-${PLUGIN}") string(REPLACE "-" "_" IMPORT_NAME "qca-${PLUGIN}")
file(APPEND "${CMAKE_BINARY_DIR}/import_plugins.h" "Q_IMPORT_PLUGIN(${IMPORT_NAME})\n") file(APPEND "${CMAKE_BINARY_DIR}/import_plugins.h" "Q_IMPORT_PLUGIN(${IMPORT_NAME})\n")
endif(WITH_${PLUGIN}_PLUGIN_INTERNAL) endif()
endforeach(PLUGIN IN LISTS PLUGINS) endforeach(PLUGIN IN LISTS PLUGINS)
endif(STATIC_PLUGINS) endif()
if(BUILD_TESTS) if(BUILD_TESTS)
enable_testing() enable_testing()
add_subdirectory(unittest) add_subdirectory(unittest)
add_subdirectory(examples) add_subdirectory(examples)
endif(BUILD_TESTS) endif()
if(BUILD_TOOLS) if(BUILD_TOOLS)
add_subdirectory(tools) add_subdirectory(tools)
endif(BUILD_TOOLS) endif()
if(DOXYGEN_FOUND) if(DOXYGEN_FOUND)
configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY) configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
@ -383,7 +381,7 @@ if(DOXYGEN_FOUND)
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/images/qca-arch.png ${CMAKE_BINARY_DIR}/images/qca-arch.png COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/images/qca-arch.png ${CMAKE_BINARY_DIR}/images/qca-arch.png
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM) COMMENT "Generating API documentation with Doxygen" VERBATIM)
endif(DOXYGEN_FOUND) endif()
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
configure_package_config_file( configure_package_config_file(
@ -413,7 +411,7 @@ if(NOT DEVELOPER_MODE)
message("!! you MUST explicity define CMAKE_INSTALL_PREFIX !!") message("!! you MUST explicity define CMAKE_INSTALL_PREFIX !!")
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
message("${ESCAPE}[0m") message("${ESCAPE}[0m")
endif(QCA_INSTALL_IN_QT_PREFIX) endif()
message("") message("")
if(USE_RELATIVE_PATHS) if(USE_RELATIVE_PATHS)

View File

@ -42,11 +42,11 @@ ENDIF(LIBGCRYPTCONFIG_EXECUTABLE)
if (LIBGCRYPT_FOUND) if (LIBGCRYPT_FOUND)
if (NOT LibGcrypt_FIND_QUIETLY) if (NOT LibGcrypt_FIND_QUIETLY)
message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}") message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}")
endif (NOT LibGcrypt_FIND_QUIETLY) endif()
else (LIBGCRYPT_FOUND) else()
if (LibGcrypt_FIND_REQUIRED) if (LibGcrypt_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libgcrypt libraries") message(FATAL_ERROR "Could not find libgcrypt libraries")
endif (LibGcrypt_FIND_REQUIRED) endif()
endif (LIBGCRYPT_FOUND) endif()
MARK_AS_ADVANCED(LIBGCRYPT_CFLAGS LIBGCRYPT_LIBRARIES) MARK_AS_ADVANCED(LIBGCRYPT_CFLAGS LIBGCRYPT_LIBRARIES)

View File

@ -23,17 +23,17 @@ else()
if(NOT WIN32) if(NOT WIN32)
find_package(PkgConfig) find_package(PkgConfig)
pkg_search_module(PKCS11H libpkcs11-helper-1) pkg_search_module(PKCS11H libpkcs11-helper-1)
endif(NOT WIN32) endif()
if (PKCS11H_FOUND) if (PKCS11H_FOUND)
if (NOT Pkcs11Helper_FIND_QUIETLY) if (NOT Pkcs11Helper_FIND_QUIETLY)
message(STATUS "Found pkcs11-helper: ${PKCS11H_LDFLAGS}") message(STATUS "Found pkcs11-helper: ${PKCS11H_LDFLAGS}")
endif (NOT Pkcs11Helper_FIND_QUIETLY) endif()
else (PKCS11H_FOUND) else()
if (Pkcs11Helper_FIND_REQUIRED) if (Pkcs11Helper_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find pkcs11-helper") message(FATAL_ERROR "Could NOT find pkcs11-helper")
endif (Pkcs11Helper_FIND_REQUIRED) endif()
endif (PKCS11H_FOUND) endif()
mark_as_advanced(PKCS11H_INCLUDE_DIRS PKCS11H_LDFLAGS PKCS11H_CFLAGS_OTHER) mark_as_advanced(PKCS11H_INCLUDE_DIRS PKCS11H_LDFLAGS PKCS11H_CFLAGS_OTHER)

View File

@ -14,7 +14,7 @@
if (SASL2_INCLUDE_DIR) if (SASL2_INCLUDE_DIR)
# Already in cache, be silent # Already in cache, be silent
set(SASL2_FIND_QUIETLY TRUE) set(SASL2_FIND_QUIETLY TRUE)
endif (SASL2_INCLUDE_DIR) endif()
FIND_PATH(SASL2_INCLUDE_DIR sasl/sasl.h) FIND_PATH(SASL2_INCLUDE_DIR sasl/sasl.h)
@ -23,18 +23,18 @@ FIND_LIBRARY(SASL2_LIBRARIES NAMES sasl2)
if (SASL2_INCLUDE_DIR AND SASL2_LIBRARIES) if (SASL2_INCLUDE_DIR AND SASL2_LIBRARIES)
set(SASL2_FOUND TRUE) set(SASL2_FOUND TRUE)
endif (SASL2_INCLUDE_DIR AND SASL2_LIBRARIES) endif()
if (SASL2_FOUND) if (SASL2_FOUND)
if (NOT Sasl2_FIND_QUIETLY) if (NOT Sasl2_FIND_QUIETLY)
message(STATUS "Found Sasl2: ${SASL2_LIBRARIES}") message(STATUS "Found Sasl2: ${SASL2_LIBRARIES}")
endif (NOT Sasl2_FIND_QUIETLY) endif()
else (SASL2_FOUND) else()
if (Sasl2_FIND_REQUIRED) if (Sasl2_FIND_REQUIRED)
message(FATAL_ERROR "Could not find sasl2 libraries") message(FATAL_ERROR "Could not find sasl2 libraries")
endif (Sasl2_FIND_REQUIRED) endif()
endif (SASL2_FOUND) endif()
MARK_AS_ADVANCED(SASL2_INCLUDE_DIR SASL2_LIBRARIES) MARK_AS_ADVANCED(SASL2_INCLUDE_DIR SASL2_LIBRARIES)

View File

@ -16,9 +16,9 @@ macro(set_enabled_plugin PLUGIN ENABLED)
# To nice looks # To nice looks
if(ENABLED) if(ENABLED)
set(ENABLED "on") set(ENABLED "on")
else(ENABLED) else()
set(ENABLED "off") set(ENABLED "off")
endif(ENABLED) endif()
set(WITH_${PLUGIN}_PLUGIN_INTERNAL ${ENABLED} CACHE INTERNAL "") set(WITH_${PLUGIN}_PLUGIN_INTERNAL ${ENABLED} CACHE INTERNAL "")
endmacro(set_enabled_plugin) endmacro(set_enabled_plugin)
@ -42,9 +42,9 @@ macro(target_link_qca_libraries TARGET)
# Check plugin for enabled # Check plugin for enabled
if(WITH_${PLUGIN}_PLUGIN_INTERNAL) if(WITH_${PLUGIN}_PLUGIN_INTERNAL)
target_link_libraries(${TARGET} qca-${PLUGIN}) target_link_libraries(${TARGET} qca-${PLUGIN})
endif(WITH_${PLUGIN}_PLUGIN_INTERNAL) endif()
endforeach(PLUGIN) endforeach(PLUGIN)
endif(STATIC_PLUGINS) endif()
endmacro(target_link_qca_libraries) endmacro(target_link_qca_libraries)
# it used to build unittests # it used to build unittests
@ -69,7 +69,7 @@ macro(install_pdb TARGET INSTALL_PATH)
get_target_property(LOCATION ${TARGET} LOCATION_RELWITHDEBINFO) get_target_property(LOCATION ${TARGET} LOCATION_RELWITHDEBINFO)
string(REGEX REPLACE "\\.[^.]*$" ".pdb" LOCATION "${LOCATION}") string(REGEX REPLACE "\\.[^.]*$" ".pdb" LOCATION "${LOCATION}")
install(FILES ${LOCATION} DESTINATION ${INSTALL_PATH} CONFIGURATIONS RelWithDebInfo) install(FILES ${LOCATION} DESTINATION ${INSTALL_PATH} CONFIGURATIONS RelWithDebInfo)
endif(MSVC) endif()
endmacro(install_pdb) endmacro(install_pdb)
macro(normalize_path PATH) macro(normalize_path PATH)

View File

@ -4,7 +4,7 @@ cmake_policy(SET CMP0007 OLD)
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") endif()
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}") string(REGEX REPLACE "\n" ";" files "${files}")
@ -19,8 +19,8 @@ foreach (file ${files})
) )
if(NOT ${rm_retval} EQUAL 0) if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0) endif()
else (EXISTS "$ENV{DESTDIR}${file}") else()
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}") endif()
endforeach(file) endforeach(file)

View File

@ -22,36 +22,36 @@ if(NOT_PLUGIN_LIST)
set(WITH_${PLUGIN}_PLUGIN "yes") set(WITH_${PLUGIN}_PLUGIN "yes")
elseif("${BUILD_PLUGINS}" STREQUAL "auto") elseif("${BUILD_PLUGINS}" STREQUAL "auto")
set(WITH_${PLUGIN}_PLUGIN "auto") set(WITH_${PLUGIN}_PLUGIN "auto")
else("${BUILD_PLUGINS}" STREQUAL "all") else()
set(WITH_${PLUGIN}_PLUGIN "no") set(WITH_${PLUGIN}_PLUGIN "no")
endif("${BUILD_PLUGINS}" STREQUAL "all") endif()
elseif(NOT WITH_${PLUGIN}_PLUGIN) elseif(NOT WITH_${PLUGIN}_PLUGIN)
set(WITH_${PLUGIN}_PLUGIN "no") set(WITH_${PLUGIN}_PLUGIN "no")
elseif("${WITH_${PLUGIN}_PLUGIN}" STREQUAL "auto") elseif("${WITH_${PLUGIN}_PLUGIN}" STREQUAL "auto")
set(WITH_${PLUGIN}_PLUGIN "auto") set(WITH_${PLUGIN}_PLUGIN "auto")
else("${WITH_${PLUGIN}_PLUGIN}" STREQUAL "") else()
set(WITH_${PLUGIN}_PLUGIN "yes") set(WITH_${PLUGIN}_PLUGIN "yes")
endif("${WITH_${PLUGIN}_PLUGIN}" STREQUAL "") endif()
# Build plugin if yes or auto # Build plugin if yes or auto
if(WITH_${PLUGIN}_PLUGIN) if(WITH_${PLUGIN}_PLUGIN)
add_subdirectory("qca-${PLUGIN}") add_subdirectory("qca-${PLUGIN}")
else(WITH_${PLUGIN}_PLUGIN) else()
disable_plugin(${PLUGIN}) disable_plugin(${PLUGIN})
endif(WITH_${PLUGIN}_PLUGIN) endif()
endforeach(PLUGIN IN LISTS PLUGINS) endforeach(PLUGIN IN LISTS PLUGINS)
else(NOT_PLUGIN_LIST) else()
# BUILD_PLUGINS has list plugins to builds # BUILD_PLUGINS has list plugins to builds
foreach(PLUGIN IN LISTS PLUGINS) foreach(PLUGIN IN LISTS PLUGINS)
list(FIND BUILD_PLUGINS "${PLUGIN}" PLUGIN_INDEX) list(FIND BUILD_PLUGINS "${PLUGIN}" PLUGIN_INDEX)
if(PLUGIN_INDEX GREATER -1) if(PLUGIN_INDEX GREATER -1)
set(WITH_${PLUGIN}_PLUGIN "yes") set(WITH_${PLUGIN}_PLUGIN "yes")
add_subdirectory("qca-${PLUGIN}") add_subdirectory("qca-${PLUGIN}")
else(PLUGIN_INDEX GREATER -1) else()
disable_plugin(${PLUGIN}) disable_plugin(${PLUGIN})
endif(PLUGIN_INDEX GREATER -1) endif()
endforeach(PLUGIN IN LISTS PLUGINS) endforeach(PLUGIN IN LISTS PLUGINS)
endif(NOT_PLUGIN_LIST) endif()
message("") message("")
message("Plugins:") message("Plugins:")

View File

@ -26,6 +26,6 @@ if(BOTAN_FOUND)
install_pdb(qca-botan ${QCA_CRYPTO_INSTALL_DIR}) install_pdb(qca-botan ${QCA_CRYPTO_INSTALL_DIR})
endif() endif()
else(BOTAN_FOUND) else()
disable_plugin("botan") disable_plugin("botan")
endif(BOTAN_FOUND) endif()

View File

@ -1,8 +1,8 @@
if(WITH_cyrus-sasl_PLUGIN STREQUAL "yes") if(WITH_cyrus-sasl_PLUGIN STREQUAL "yes")
find_package(Sasl2 REQUIRED) find_package(Sasl2 REQUIRED)
else(WITH_cyrus-sasl_PLUGIN STREQUAL "yes") else()
find_package(Sasl2) find_package(Sasl2)
endif(WITH_cyrus-sasl_PLUGIN STREQUAL "yes") endif()
if(SASL2_FOUND) if(SASL2_FOUND)
enable_plugin("cyrus-sasl") enable_plugin("cyrus-sasl")
@ -25,6 +25,6 @@ if(SASL2_FOUND)
install_pdb(qca-cyrus-sasl ${QCA_CRYPTO_INSTALL_DIR}) install_pdb(qca-cyrus-sasl ${QCA_CRYPTO_INSTALL_DIR})
endif() endif()
else(SASL2_FOUND) else()
disable_plugin("cyrus-sasl") disable_plugin("cyrus-sasl")
endif(SASL2_FOUND) endif()

View File

@ -1,8 +1,8 @@
if(WITH_gcrypt_PLUGIN STREQUAL "yes") if(WITH_gcrypt_PLUGIN STREQUAL "yes")
find_package(LibGcrypt REQUIRED) find_package(LibGcrypt REQUIRED)
else(WITH_gcrypt_PLUGIN STREQUAL "yes") else()
find_package(LibGcrypt) find_package(LibGcrypt)
endif(WITH_gcrypt_PLUGIN STREQUAL "yes") endif()
if(LIBGCRYPT_FOUND) if(LIBGCRYPT_FOUND)
include(CheckTypeSize) include(CheckTypeSize)
@ -35,10 +35,10 @@ if(LIBGCRYPT_FOUND)
install_pdb(qca-gcrypt ${QCA_CRYPTO_INSTALL_DIR}) install_pdb(qca-gcrypt ${QCA_CRYPTO_INSTALL_DIR})
endif() endif()
else(HAVE_GCRY_ERROR_T) else()
message(STATUS "libgcrypt seems to be too old") message(STATUS "libgcrypt seems to be too old")
disable_plugin("gcrypt") disable_plugin("gcrypt")
endif(HAVE_GCRY_ERROR_T) endif()
else(LIBGCRYPT_FOUND) else()
disable_plugin("gcrypt") disable_plugin("gcrypt")
endif(LIBGCRYPT_FOUND) endif()

View File

@ -46,7 +46,7 @@ target_link_libraries(qca-gnupg Qt5::Core ${QCA_LIB_NAME})
if (WIN32) if (WIN32)
target_link_libraries(qca-gnupg advapi32) target_link_libraries(qca-gnupg advapi32)
endif (WIN32) endif()
if(NOT DEVELOPER_MODE) if(NOT DEVELOPER_MODE)
install(TARGETS qca-gnupg DESTINATION install(TARGETS qca-gnupg DESTINATION

View File

@ -2,9 +2,9 @@
if(WITH_ossl_PLUGIN STREQUAL "yes") if(WITH_ossl_PLUGIN STREQUAL "yes")
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
else(WITH_ossl_PLUGIN STREQUAL "yes") else()
find_package(OpenSSL) find_package(OpenSSL)
endif(WITH_ossl_PLUGIN STREQUAL "yes") endif()
if(OPENSSL_FOUND) if(OPENSSL_FOUND)
enable_plugin("ossl") enable_plugin("ossl")
@ -14,16 +14,16 @@ if(OPENSSL_FOUND)
check_function_exists(EVP_md2 HAVE_OPENSSL_MD2) check_function_exists(EVP_md2 HAVE_OPENSSL_MD2)
if(HAVE_OPENSSL_MD2) if(HAVE_OPENSSL_MD2)
add_definitions(-DHAVE_OPENSSL_MD2) add_definitions(-DHAVE_OPENSSL_MD2)
else(HAVE_OPENSSL_MD2) else()
message(WARNING "qca-ossl will be compiled without MD2 digest algorithm support") message(WARNING "qca-ossl will be compiled without MD2 digest algorithm support")
endif(HAVE_OPENSSL_MD2) endif()
check_function_exists(EVP_aes_128_ctr HAVE_OPENSSL_AES_CTR) check_function_exists(EVP_aes_128_ctr HAVE_OPENSSL_AES_CTR)
if(HAVE_OPENSSL_AES_CTR) if(HAVE_OPENSSL_AES_CTR)
add_definitions(-DHAVE_OPENSSL_AES_CTR) add_definitions(-DHAVE_OPENSSL_AES_CTR)
else(HAVE_OPENSSL_AES_CTR) else()
message(WARNING "qca-ossl will be compiled without AES CTR mode encryption support") message(WARNING "qca-ossl will be compiled without AES CTR mode encryption support")
endif(HAVE_OPENSSL_AES_CTR) endif()
check_function_exists(EVP_aes_128_gcm HAVE_OPENSSL_AES_GCM) check_function_exists(EVP_aes_128_gcm HAVE_OPENSSL_AES_GCM)
if(HAVE_OPENSSL_AES_GCM) if(HAVE_OPENSSL_AES_GCM)
@ -42,9 +42,9 @@ if(OPENSSL_FOUND)
check_function_exists(EVP_sha HAVE_OPENSSL_SHA0) check_function_exists(EVP_sha HAVE_OPENSSL_SHA0)
if(HAVE_OPENSSL_SHA0) if(HAVE_OPENSSL_SHA0)
add_definitions(-DHAVE_OPENSSL_SHA0) add_definitions(-DHAVE_OPENSSL_SHA0)
else(HAVE_OPENSSL_SHA0) else()
message(WARNING "qca-ossl will be compiled without SHA-0 digest algorithm support") message(WARNING "qca-ossl will be compiled without SHA-0 digest algorithm support")
endif(HAVE_OPENSSL_SHA0) endif()
set(QCA_OSSL_SOURCES qca-ossl.cpp) set(QCA_OSSL_SOURCES qca-ossl.cpp)
@ -67,6 +67,6 @@ if(OPENSSL_FOUND)
install_pdb(qca-ossl ${QCA_CRYPTO_INSTALL_DIR}) install_pdb(qca-ossl ${QCA_CRYPTO_INSTALL_DIR})
endif() endif()
else(OPENSSL_FOUND) else()
disable_plugin("ossl") disable_plugin("ossl")
endif(OPENSSL_FOUND) endif()

View File

@ -3,10 +3,10 @@
if(WITH_pkcs11_PLUGIN STREQUAL "yes") if(WITH_pkcs11_PLUGIN STREQUAL "yes")
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
find_package(Pkcs11Helper REQUIRED) find_package(Pkcs11Helper REQUIRED)
else(WITH_pkcs11_PLUGIN STREQUAL "yes") else()
find_package(OpenSSL) find_package(OpenSSL)
find_package(Pkcs11Helper) find_package(Pkcs11Helper)
endif(WITH_pkcs11_PLUGIN STREQUAL "yes") endif()
if(OPENSSL_FOUND AND PKCS11H_FOUND) if(OPENSSL_FOUND AND PKCS11H_FOUND)
enable_plugin("pkcs11") enable_plugin("pkcs11")
@ -25,7 +25,7 @@ if(OPENSSL_FOUND AND PKCS11H_FOUND)
target_link_libraries(qca-pkcs11 ${PKCS11H_LDFLAGS}) target_link_libraries(qca-pkcs11 ${PKCS11H_LDFLAGS})
if (WIN32) if (WIN32)
target_link_libraries(qca-pkcs11 pkcs11-helper.dll) target_link_libraries(qca-pkcs11 pkcs11-helper.dll)
endif(WIN32) endif()
if(NOT DEVELOPER_MODE) if(NOT DEVELOPER_MODE)
install(TARGETS qca-pkcs11 install(TARGETS qca-pkcs11
@ -35,6 +35,6 @@ if(OPENSSL_FOUND AND PKCS11H_FOUND)
install_pdb(qca-pkcs11 ${QCA_CRYPTO_INSTALL_DIR}) install_pdb(qca-pkcs11 ${QCA_CRYPTO_INSTALL_DIR})
endif() endif()
else(OPENSSL_FOUND AND PKCS11H_FOUND) else()
disable_plugin("pkcs11") disable_plugin("pkcs11")
endif(OPENSSL_FOUND AND PKCS11H_FOUND) endif()

View File

@ -13,7 +13,7 @@ int main() { void *f = 0; return mlock(f,8); }
if(NOT MLOCK_TAKES_VOID) if(NOT MLOCK_TAKES_VOID)
MESSAGE(STATUS "mlock(2) does not take a void *") MESSAGE(STATUS "mlock(2) does not take a void *")
ADD_DEFINITIONS(-DMLOCK_NOT_VOID_PTR) ADD_DEFINITIONS(-DMLOCK_NOT_VOID_PTR)
endif(NOT MLOCK_TAKES_VOID) endif()
if(DEVELOPER_MODE) if(DEVELOPER_MODE)
add_definitions(-DQCA_PLUGIN_PATH="${CMAKE_BINARY_DIR}/lib/${QCA_LIB_NAME}") add_definitions(-DQCA_PLUGIN_PATH="${CMAKE_BINARY_DIR}/lib/${QCA_LIB_NAME}")
@ -84,7 +84,7 @@ ADD_DEFINITIONS(
if(UNIX) if(UNIX)
ADD_DEFINITIONS( -DBOTAN_EXT_ALLOC_MMAP) ADD_DEFINITIONS( -DBOTAN_EXT_ALLOC_MMAP)
endif(UNIX) endif()
SET( botan_SOURCES SET( botan_SOURCES
${botan_BASE}/util.cpp ${botan_BASE}/util.cpp
@ -128,7 +128,7 @@ TARGET_LINK_LIBRARIES(${QCA_LIB_NAME} Qt5::Core)
if(WIN32) if(WIN32)
TARGET_LINK_LIBRARIES(${QCA_LIB_NAME} crypt32 ws2_32) TARGET_LINK_LIBRARIES(${QCA_LIB_NAME} crypt32 ws2_32)
endif(WIN32) endif()
if(APPLE) if(APPLE)
set(COREFOUNDATION_LIBRARY "-framework CoreFoundation") set(COREFOUNDATION_LIBRARY "-framework CoreFoundation")
@ -140,7 +140,7 @@ if(APPLE)
INSTALL_NAME_DIR "${QCA_LIBRARY_INSTALL_DIR}" INSTALL_NAME_DIR "${QCA_LIBRARY_INSTALL_DIR}"
) )
endif() endif()
endif(APPLE) endif()
if(NOT ANDROID) if(NOT ANDROID)
set_target_properties(${QCA_LIB_NAME} PROPERTIES set_target_properties(${QCA_LIB_NAME} PROPERTIES