This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathCMakeLists.txt
57 lines (46 loc) · 1.53 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
cmake_minimum_required(VERSION 3.0.2)
project("Lily" C)
if(MSVC)
string(REPLACE "/W3" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
add_definitions(/wd4201)
add_definitions(/wd4204)
add_definitions(/wd4214)
add_definitions(/MP)
set(CMAKE_CTEST_COMMAND copy lily.exe ..)
else()
set(CMAKE_CTEST_COMMAND cp lily ..)
if(DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
endif(DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-implicit-fallthrough -Wsign-compare -Wshadow")
if(WITH_COVERAGE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -fprofile-arcs -ftest-coverage")
endif(WITH_COVERAGE)
endif()
set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib")
set(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}")
set(LILY_MAJOR "2")
set(LILY_MINOR "0")
# BSD libc includes the dl* functions and there's no libdl on them.
# Unfortunately, CMake doesn't seem to distinguish *BSD from the other *nixen.
STRING(REGEX MATCH "BSD" IS_BSD ${CMAKE_SYSTEM_NAME})
if(IS_BSD OR MINGW OR MSVC OR APPLE)
set(LILY_NEED_DL 0)
else()
set(LILY_NEED_DL 1)
endif()
# Windows doesn't have a math library to link against.
if(WIN32)
set(LILY_NEED_M 0)
else()
set(LILY_NEED_M 1)
endif()
add_subdirectory(src)
add_subdirectory(run)
add_subdirectory(test)
set(TEST_COMMAND cd .. && ./pre-commit-tests)
add_custom_target(check ${CMAKE_CTEST_COMMAND}
COMMAND ${TEST_COMMAND}
DEPENDS lily VERBATIM)