]> wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - CMakeLists.txt
elbrus: Workaround `-Werror=assign-where-compare-meant'
[openssl-gost/engine.git] / CMakeLists.txt
index 36613f1c74b07331b86a4cfb8fbaae05a3618c6a..8036d342f192ebd36140897d1c441cb1e41551c0 100644 (file)
@@ -4,6 +4,7 @@ project(gost-engine LANGUAGES C)
 include(GNUInstallDirs)
 include(CheckLibraryExists)
 include(CheckFunctionExists)
+include(CheckCSourceRuns)
 
 enable_testing()
 
@@ -13,7 +14,7 @@ include_directories(${OPENSSL_INCLUDE_DIR})
 if (CMAKE_C_COMPILER_ID MATCHES "Clang")
  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)
+ add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Wno-error=unknown-pragmas)
 elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS)
@@ -26,6 +27,11 @@ if (ASAN)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g3 -fno-omit-frame-pointer")
 endif()
 
+# DEPRECATEDIN_3_0 CMAC
+set_source_files_properties(gost_omac.c PROPERTIES COMPILE_FLAGS -Wno-error=deprecated-declarations)
+# DEPRECATEDIN_3_0 HMAC
+set_source_files_properties(gost_keyexpimp.c PROPERTIES COMPILE_FLAGS -Wno-error=deprecated-declarations)
+
 set(CMAKE_C_STANDARD 90)
 CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME_C)
 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_CLOCK_GETTIME_RT)
@@ -42,6 +48,23 @@ else()
  add_definitions(-DL_ENDIAN)
 endif()
 
+check_c_source_runs("
+  #ifdef _MSC_VER
+  # include <intrin.h>
+  #else
+  # include <x86intrin.h>
+  #endif
+  int main(void) {
+    unsigned long long x = -1, y = 1, r;
+    unsigned char cf;
+    cf = _addcarry_u64(1, x, y, &r);
+    return !(cf == 1 && r == 1);
+  }
+  " ADDCARRY_U64)
+if (ADDCARRY_U64)
+  add_definitions(-DHAVE_ADDCARRY_U64)
+endif()
+
 set(BIN_DIRECTORY bin)
 
 # Same soversion as OpenSSL