-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
48 lines (39 loc) · 1.29 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
cmake_minimum_required(VERSION 3.1.3)
project(Errol)
enable_testing()
include(CTest)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY build)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY test)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
if(MINGW)
add_definitions(-DMINGW_HAS_SECURE_API)
endif()
if(NOT MSVC)
add_definitions(-Wall)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)
else()
foreach(flagvar CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flagvar} "${${flagvar}}")
string(REGEX REPLACE "/MDd" "/MTd" ${flagvar} "${${flagvar}}")
endforeach()
endif()
include_directories(lib)
file(GLOB errol_srcs lib/*.c)
file(GLOB tests_srcs test/*.c test/*.cpp)
add_library(errol ${errol_srcs})
if(BUILD_TESTING)
find_package(DoubleConversion REQUIRED)
find_package(GMP REQUIRED)
include_directories(${DOUBLE_CONVERSION_INCLUDE_DIRS})
include_directories(${GMP_INCLUDE_DIR})
add_executable(run ${tests_srcs})
target_link_libraries(run errol)
target_link_libraries(run ${DOUBLE_CONVERSION_LIBRARIES})
target_link_libraries(run ${GMP_LIBRARIES})
add_test(test4 test/run --fuzz4=100000)
endif()