From b335be86bde20fab93e32cdd512162c43009d584 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Mon, 27 Mar 2017 15:57:08 +0300 Subject: cmake: check for pcre and openssl headers are present --- CMakeLists.txt | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cf2b901..1b0dbe83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,20 @@ IF (NOT DEFINED LIB_SUFFIX) ENDIF (ARCH STREQUAL x86_64) ENDIF (NOT DEFINED LIB_SUFFIX) +#color console example message(FATAL_ERROR "${Esc}[31m Red Text ${Esc}[m Restore Normal Text") +string(ASCII 27 Esc) + +#Check libpcre +find_library(PCRE_LIBRARY pcre + HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib + PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib +) + +IF(NOT PCRE_LIBRARY) + message(FATAL_ERROR "${Esc}[31mRequired libpcre not found.\n Install libpcre3-dev and run cmake again${Esc}[m") +ENDIF(NOT PCRE_LIBRARY) + + IF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT IGNORE_GIT) EXECUTE_PROCESS( COMMAND git log --no-color @@ -48,8 +62,15 @@ if (NOT BUILD_DRIVER_ONLY) if (NOT DEFINED CRYPTO) set(CRYPTO OPENSSL) endif (NOT DEFINED CRYPTO) - + if (CRYPTO STREQUAL OPENSSL) + find_library(CRYPTO_LIBRARY ssl + HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib + PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib + ) + IF(NOT CRYPTO_LIBRARY) + message(FATAL_ERROR "${Esc}[31mRequired libcrypto-0.9.8 or probably later (openssl-0.9.8) not found.\n Install libssl-dev and run cmake again${Esc}[m") + ENDIF(NOT CRYPTO_LIBRARY) add_definitions(-DCRYPTO_OPENSSL) set(crypto_lib crypto ssl) elseif (CRYPTO STREQUAL TOMCRYPT) -- cgit v1.2.3