forked from NoahBz/Easy-BigInt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
74 lines (63 loc) · 2.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# CMakeList.txt: LargeDynamicBitSetAndIntegerNumber 的 CMake 项目,在此处包括源代码并定义
# 项目特定的逻辑。
#
cmake_minimum_required (VERSION 3.8)
#set(CMAKE_BUILD_TYPE release)
project ("LargeDynamicBitSetAndIntegerNumber")
# 设置默认的构建类型为 Debug,如果没有指定构建类型
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_BUILD_TYPE debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
# 设置 Debug 和 Release 的编译选项
if(MSVC)
add_compile_options(/W4 /Zc:__cplusplus /utf-8)
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11")
message(FATAL_ERROR "GNU CXX compiler version is too small !")
endif()
if(CMAKE_BUILD_TYPE EQUAL release)
add_compile_options(-Wall -O2 -Wextra -fsigned-char -finput-charset=UTF-8 -fexec-charset=UTF-8)
else()
add_compile_options(-g -O0 -Wall -Wextra -fsigned-char -finput-charset=UTF-8 -fexec-charset=UTF-8)
endif()
endif()
endif()
add_library(BigNumberSystem
BigInteger.hpp
BigInteger.cpp
BigFraction.hpp
BigFraction.cpp
PrimeNumberTester.hpp
PrimeNumberTester.cpp
)
add_library(CryptographySymmetricKey
BinaryCipherTest.hpp
BinaryCipherTest.cpp
"HardPoly1305.cpp")
target_link_libraries(CryptographySymmetricKey PRIVATE BigNumberSystem)
add_library(CryptographyAsymmetricKey
CryptographyAsymmetricKey.hpp
CryptographyAsymmetricKey.cpp
)
target_link_libraries(CryptographyAsymmetricKey PRIVATE BigNumberSystem)
add_executable(TestCryptography
BigIntegerTest.hpp
BigIntegerTest.cpp
main.cpp
)
target_link_libraries(TestCryptography PRIVATE CryptographySymmetricKey CryptographyAsymmetricKey)
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET BigNumberSystem PROPERTY CXX_STANDARD 17)
set_property(TARGET CryptographySymmetricKey PROPERTY CXX_STANDARD 17)
set_property(TARGET CryptographyAsymmetricKey PROPERTY CXX_STANDARD 17)
set_property(TARGET TestCryptography PROPERTY CXX_STANDARD 17)
set_property(TARGET BigNumberSystem PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET CryptographySymmetricKey PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET CryptographyAsymmetricKey PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET TestCryptography PROPERTY CXX_STANDARD_REQUIRED ON)
endif()
# TODO: 如有需要,请添加测试并安装目标。