X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=CMakeLists.txt;h=198d746d32821a12eddaa3869bf1dc9392ec226d;hb=b629c446ff7246e526999bfdd2657e774faf306f;hp=cbbf312d49e5e487c99725a7b324ed37ca0d0e34;hpb=6161deb92a6f47e192354c0e3c86afe69bfef6e7;p=openssl-gost%2Fengine.git diff --git a/CMakeLists.txt b/CMakeLists.txt index cbbf312..198d746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(gost-engine LANGUAGES C) include(GNUInstallDirs) +include(CheckLibraryExists) +include(CheckFunctionExists) enable_testing() @@ -9,7 +11,7 @@ find_package(OpenSSL 1.1.1 REQUIRED) include_directories(${OPENSSL_INCLUDE_DIR}) if (CMAKE_C_COMPILER_ID MATCHES "Clang") - add_compile_options(-Qunused-arguments) + add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Qunused-arguments) elseif(CMAKE_C_COMPILER_ID MATCHES "GNU") add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb) elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") @@ -25,6 +27,11 @@ if (ASAN) endif() set(CMAKE_C_STANDARD 90) +CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME_C) +CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_CLOCK_GETTIME_RT) +if(HAVE_CLOCK_GETTIME_RT AND NOT HAVE_CLOCK_GETTIME_C) + set(CLOCK_GETTIME_LIB rt) +endif() include (TestBigEndian) TEST_BIG_ENDIAN(IS_BIG_ENDIAN) @@ -173,7 +180,7 @@ set_tests_properties(engine PROPERTIES ENVIRONMENT endif() add_executable(sign benchmark/sign.c) -target_link_libraries(sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY}) +target_link_libraries(sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${CLOCK_GETTIME_LIB}) add_library(gost_core STATIC ${GOST_LIB_SOURCE_FILES}) set_target_properties(gost_core PROPERTIES POSITION_INDEPENDENT_CODE ON)