-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
40 lines (29 loc) · 1019 Bytes
/
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
cmake_minimum_required(VERSION 3.0.2)
project(bignum)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(CheckCXXCompilerFlag)
find_path(GMP_INCLUDE_DIR gmp.h
PATHS ${GMP_PREFIX}/include /usr/include /usr/local/include )
find_library(GMP_LIBRARY gmp)
if(GMP_INCLUDE_DIR)
include_directories(${GMP_INCLUDE_DIR})
endif()
# We need haswell for TZCNT/LZCNT
#check_cxx_compiler_flag("-march=haswell" has_march_haswell "int main() { return 0; }")
#if (has_march_haswell)
# list(APPEND CMAKE_CXX_FLAGS -march=haswell)
#endif()
include_directories(src)
add_library(bignum src/bignum.cc)
enable_testing()
add_executable(test_bignum tests/test_bignum.cc)
target_link_libraries(test_bignum bignum)
add_test(TEST_BIGNUM test_bignum)
add_executable(test_wideint tests/test_wideint.cc)
target_link_libraries(test_wideint bignum)
add_test(TEST_WIDEINT test_wideint)
if(GMP_LIBRARY)
add_executable(bench_bignum tests/bench_bignum.cc)
target_link_libraries(bench_bignum bignum ${GMP_LIBRARY})
endif()