-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
63 lines (43 loc) · 1.48 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
cmake_minimum_required(VERSION 3.11)
set(CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/libs")
project(FermatPrimeTest VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# option(BUILD_TESTS "Test against Boost, GMP, and OpenSSL." ON)
add_library(fermat_test INTERFACE)
target_include_directories(fermat_test INTERFACE fermat)
if(BUILD_TESTS)
if(MSVC)
#add_compile_options(/W2)
else()
add_compile_options(-Wall)
endif()
include_directories(${CMAKE_SOURCE_DIR}/include)
link_directories(${CMAKE_SOURCE_DIR}/libs)
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
if(UNIX)
add_definitions(-DUNIX)
endif()
if(WIN32)
add_definitions(-D_WIN32_WINT=0x0601 -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)
endif()
if (MSVC)
set_target_properties(${BUILD_TARGET} PROPERTIES LINK_FLAGS "/PROFILE")
endif()
find_package(Boost)
include_directories(${Boost_INCLUDE_DIRS})
find_package(OpenMP)
add_executable(FermatPrimeTest main.cpp fermat_prime.cpp ump_test.cpp)
target_link_libraries(FermatPrimeTest fermat_test)
if(WIN32)
target_link_libraries(FermatPrimeTest mpir)
else()
find_library(gmp gmp)
target_link_libraries(FermatPrimeTest gmp)
endif()
if(OpenMP_CXX_FOUND)
target_link_libraries(FermatPrimeTest OpenMP::OpenMP_CXX)
endif()
target_link_libraries(FermatPrimeTest ${OPENSSL_LIBRARIES})
endif()