forked from grayed/tlc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
35 lines (27 loc) · 1.06 KB
/
CMakeLists.txt
File metadata and controls
35 lines (27 loc) · 1.06 KB
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
cmake_minimum_required(VERSION 3.7)
project(tlc LANGUAGES C)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(CTest)
add_compile_options(-Wall)
# notsupp in 3.7 string(PREPEND CMAKE_C_FLAGS_DEBUG "-O0 ")
set(CMAKE_C_FLAGS_DEBUG "-O0 ${CMAKE_C_FLAGS_DEBUG}")
if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
endif()
add_executable(tlc tlc.c)
if (APPLE OR CMAKE_SYSTEM_NAME MATCHES ".*BSD.*")
message(STATUS "It looks you're running BSD system and do not need libbsd")
else()
find_package(BSD REQUIRED)
list(APPEND BSD_DEFINITIONS -DLIBBSD_OVERLAY)
list(APPEND BSD_DEFINITIONS -D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700)
target_compile_definitions(tlc PRIVATE ${BSD_DEFINITIONS})
target_include_directories(tlc BEFORE PRIVATE ${BSD_INCLUDE_DIRS})
target_link_libraries(tlc ${BSD_LIBRARIES})
endif()
install(TARGETS tlc RUNTIME DESTINATION bin)
if (BUILD_TESTING)
message("-- Tests are enabled, looking for additional dependencies")
find_program(JOT_EXECUTABLE jot REQUIRED)
add_subdirectory(tests)
endif()