@@ -8,13 +8,13 @@ option(ENABLE_CODECOV "Enable code coverage analysis." OFF)
88set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG } -W -Wall -Wextra -pedantic" )
99set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG } -W -Wall -Wextra -pedantic" )
1010
11- if ( TIDY )
12- find_program ( CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable" )
13- if ( NOT CLANG_TIDY_EXE )
14- message ( STATUS "clang-tidy not found." )
15- else ( )
16- message ( STATUS "clang-tidy found: ${CLANG_TIDY_EXE} " )
17- set ( DO_CLANG_TIDY "${CLANG_TIDY_EXE} "
11+ if ( TIDY)
12+ find_program (CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable" )
13+ if ( NOT CLANG_TIDY_EXE)
14+ message (STATUS "clang-tidy not found." )
15+ else ( NOT CLANG_TIDY_EXE )
16+ message (STATUS "clang-tidy found: ${CLANG_TIDY_EXE} " )
17+ set (DO_CLANG_TIDY "${CLANG_TIDY_EXE} "
1818 "-checks=-*,\
1919clang-analyzer-*,\
2020misc-*,\
@@ -30,19 +30,40 @@ bugprone-*,\
3030-modernize-use-trailing-return-type,\
3131-readability-braces-around-statements, \
3232-readability-function-cognitive-complexity,\
33- -readability-magic-numbers" )
34- endif ( )
35- endif ( )
33+ -readability-magic-numbers" )
34+ endif ( NOT CLANG_TIDY_EXE )
35+ endif ( TIDY )
3636
37- if ( IWYU )
38- find_program ( INCLUDE_WHAT_YOU_USE_EXE NAMES "include-what-you-use" DOC "Path to include-what-you-use executable" )
39- if ( NOT INCLUDE_WHAT_YOU_USE_EXE )
40- message ( STATUS "include-what-you-use not found." )
41- else ( )
42- message ( STATUS "include-what-you-use found: ${INCLUDE_WHAT_YOU_USE_EXE} " )
37+ if ( IWYU)
38+ find_program (INCLUDE_WHAT_YOU_USE_EXE NAMES "include-what-you-use" DOC "Path to include-what-you-use executable" )
39+ if ( NOT INCLUDE_WHAT_YOU_USE_EXE)
40+ message (STATUS "include-what-you-use not found." )
41+ else ( NOT INCLUDE_WHAT_YOU_USE_EXE )
42+ message (STATUS "include-what-you-use found: ${INCLUDE_WHAT_YOU_USE_EXE} " )
4343 set ( DO_INCLUDE_WHAT_YOU_USE "${INCLUDE_WHAT_YOU_USE_EXE} " )
44- endif ()
45- endif ()
44+ endif (NOT INCLUDE_WHAT_YOU_USE_EXE )
45+ endif (IWYU )
46+
47+ find_package (OpenSSL 1.1.0 REQUIRED )
48+
49+ try_compile (HAVE_GF2M_CURVES ${CMAKE_CURRENT_BINARY_DIR } "${CMAKE_SOURCE_DIR } /checks/openssl_supports_ec_curve_gf2m.c" LINK_LIBRARIES OpenSSL::Crypto )
50+ if (NOT HAVE_GF2M_CURVES)
51+ message (FATAL_ERROR "OpenSSL is built without support of elliptic curves over GF2m" )
52+ endif (NOT HAVE_GF2M_CURVES )
53+
54+ try_compile (COPY_2ND_ARG_IS_CONST ${CMAKE_CURRENT_BINARY_DIR } "${CMAKE_SOURCE_DIR } /checks/openssl_pkey_meth_copy_signature.c" COMPILE_DEFINITIONS -Werror=incompatible-pointer-types LINK_LIBRARIES OpenSSL::Crypto )
55+ if (COPY_2ND_ARG_IS_CONST)
56+ message (STATUS "Second argument of PKEY copy method is constant." )
57+ else (COPY_2ND_ARG_IS_CONST )
58+ message (STATUS "Second argument of PKEY copy method is NOT constant." )
59+ endif (COPY_2ND_ARG_IS_CONST )
60+
61+ try_compile (DECODE_2ND_ARG_IS_CONST ${CMAKE_CURRENT_BINARY_DIR } "${CMAKE_SOURCE_DIR } /checks/openssl_pkey_asn_decode_signature.c" COMPILE_DEFINITIONS -Werror=incompatible-pointer-types LINK_LIBRARIES OpenSSL::Crypto )
62+ if (DECODE_2ND_ARG_IS_CONST)
63+ message (STATUS "Second argument of PKEY ASN.1 decode method is constant." )
64+ else (DECODE_2ND_ARG_IS_CONST )
65+ message (STATUS "Second argument of PKEY ASN.1 decode method is NOT constant." )
66+ endif (DECODE_2ND_ARG_IS_CONST )
4667
4768add_subdirectory (dstulib )
4869add_subdirectory (engine )
@@ -63,9 +84,9 @@ if(ENABLE_CODECOV AND CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
6384 )
6485 if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
6586 target_link_options (coverage_config INTERFACE --coverage )
66- else ()
87+ else (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 )
6788 target_link_libraries (coverage_config INTERFACE --coverage )
68- endif ()
89+ endif (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 )
6990else (ENABLE_CODECOV AND CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" )
7091 if (ENABLE_CODECOV)
7192 message (FATAL_ERROR "Unknown compiler id: ${CMAKE_C_COMPILER_ID } " )
0 commit comments