aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt86
1 files changed, 38 insertions, 48 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f1925ef..acc1e606 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,6 @@
-cmake_minimum_required(VERSION 3.3.0)
-cmake_policy(SET CMP0048 NEW)
+cmake_minimum_required(VERSION 3.12.0)
-# Specify search path for CMake modules to be loaded by include()
+# Specify search path for CMake modules to be loaded by include()
# and find_package()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
@@ -10,7 +9,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
include(DefineCMakeDefaults)
include(DefineCompilerFlags)
-project(libssh VERSION 0.8.90 LANGUAGES C)
+project(libssh VERSION 0.10.90 LANGUAGES C CXX)
# global needed variable
set(APPLICATION_NAME ${PROJECT_NAME})
@@ -22,7 +21,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
# Increment AGE. Set REVISION to 0
# If the source code was changed, but there were no interface changes:
# Increment REVISION.
-set(LIBRARY_VERSION "4.8.1")
+set(LIBRARY_VERSION "4.9.0")
set(LIBRARY_SOVERSION "4")
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
@@ -49,32 +48,11 @@ endif (WITH_ZLIB)
if (WITH_GCRYPT)
find_package(GCrypt 1.5.0 REQUIRED)
- if (NOT GCRYPT_FOUND)
- message(FATAL_ERROR "Could not find GCrypt")
- endif (NOT GCRYPT_FOUND)
elseif(WITH_MBEDTLS)
find_package(MbedTLS REQUIRED)
- if (NOT MBEDTLS_FOUND)
- message(FATAL_ERROR "Could not find mbedTLS")
- endif (NOT MBEDTLS_FOUND)
-else (WITH_GCRYPT)
- find_package(OpenSSL 1.0.1)
- if (OPENSSL_FOUND)
- # On CMake < 3.16, OPENSSL_CRYPTO_LIBRARIES is usually a synonym for OPENSSL_CRYPTO_LIBRARY, but is not defined
- # when building on Windows outside of Cygwin. We provide the synonym here, if FindOpenSSL didn't define it already.
- if (NOT DEFINED OPENSSL_CRYPTO_LIBRARIES)
- set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
- endif (NOT DEFINED OPENSSL_CRYPTO_LIBRARIES)
- else (OPENSSL_FOUND)
- find_package(GCrypt)
- if (NOT GCRYPT_FOUND)
- find_package(MbedTLS)
- if (NOT MBEDTLS_FOUND)
- message(FATAL_ERROR "Could not find OpenSSL, GCrypt or mbedTLS")
- endif (NOT MBEDTLS_FOUND)
- endif (NOT GCRYPT_FOUND)
- endif (OPENSSL_FOUND)
-endif(WITH_GCRYPT)
+else()
+ find_package(OpenSSL 1.1.1 REQUIRED)
+endif()
if (UNIT_TESTING)
find_package(CMocka REQUIRED)
@@ -89,13 +67,6 @@ if (WITH_GSSAPI)
find_package(GSSAPI)
endif (WITH_GSSAPI)
-if (WITH_PKCS11_URI)
- find_package(softhsm)
- if (NOT SOFTHSM_FOUND)
- message(SEND_ERROR "Could not find softhsm module!")
- endif (NOT SOFTHSM_FOUND)
-endif (WITH_PKCS11_URI)
-
if (WITH_NACL)
find_package(NaCl)
if (NOT NACL_FOUND)
@@ -103,10 +74,6 @@ if (WITH_NACL)
endif (NOT NACL_FOUND)
endif (WITH_NACL)
-if (BSD OR SOLARIS OR OSX)
- find_package(Argp)
-endif (BSD OR SOLARIS OR OSX)
-
# Disable symbol versioning in non UNIX platforms
if (UNIX)
find_package(ABIMap 0.3.1)
@@ -118,14 +85,18 @@ endif (UNIX)
include(ConfigureChecks.cmake)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+if (NOT HAVE_ARGP_PARSE)
+ find_package(Argp)
+endif (NOT HAVE_ARGP_PARSE)
+
# check subdirectories
add_subdirectory(doc)
add_subdirectory(include)
add_subdirectory(src)
# pkg-config file
-if (UNIX)
-configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc)
+if (UNIX OR MINGW)
+configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc @ONLY)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
@@ -134,7 +105,7 @@ install(
COMPONENT
pkgconfig
)
-endif (UNIX)
+endif (UNIX OR MINGW)
# CMake config files
include(CMakePackageConfigHelpers)
@@ -216,16 +187,35 @@ if (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
endif(UPDATE_ABI)
endif (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
+# Coverage
+if (WITH_COVERAGE)
+ include(CodeCoverage)
+ setup_target_for_coverage_lcov(
+ NAME "coverage"
+ EXECUTABLE make test
+ DEPENDENCIES ssh tests)
+ set(GCOVR_ADDITIONAL_ARGS --xml-pretty --exclude-unreachable-branches --print-summary)
+ setup_target_for_coverage_gcovr_xml(
+ NAME "coverage_xml"
+ EXECUTABLE make test
+ DEPENDENCIES ssh tests)
+endif (WITH_COVERAGE)
+
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source DEPENDS ${_SYMBOL_TARGET} VERBATIM)
-# Link compile database for clangd
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
- "${CMAKE_BINARY_DIR}/compile_commands.json"
- "${CMAKE_SOURCE_DIR}/compile_commands.json")
+get_directory_property(hasParent PARENT_DIRECTORY)
+if(NOT(hasParent))
+ # Link compile database for clangd if we are the master project
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+ "${CMAKE_BINARY_DIR}/compile_commands.json"
+ "${CMAKE_SOURCE_DIR}/compile_commands.json")
+endif()
message(STATUS "********************************************")
message(STATUS "********** ${PROJECT_NAME} build options : **********")
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+message(STATUS "Coverage: ${WITH_COVERAGE}")
message(STATUS "zlib support: ${WITH_ZLIB}")
message(STATUS "libgcrypt support: ${WITH_GCRYPT}")
message(STATUS "libmbedTLS support: ${WITH_MBEDTLS}")
@@ -241,7 +231,7 @@ message(STATUS "Unit testing: ${UNIT_TESTING}")
message(STATUS "Client code testing: ${CLIENT_TESTING}")
message(STATUS "Blowfish cipher support: ${WITH_BLOWFISH_CIPHER}")
message(STATUS "PKCS #11 URI support: ${WITH_PKCS11_URI}")
-message(STATUS "DSA support: ${WITH_DSA}")
+message(STATUS "With PKCS #11 provider support: ${WITH_PKCS11_PROVIDER}")
set(_SERVER_TESTING OFF)
if (WITH_SERVER)
set(_SERVER_TESTING ${SERVER_TESTING})