forked from sartura/uci2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (37 loc) · 1.17 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
cmake_minimum_required(VERSION 2.8)
project(uci2 C)
# compile options
include(CompileOptions.cmake)
# include dir
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/)
# libuci2 library
add_library(${PROJECT_NAME} SHARED
src/libuci2.c
src/uci2_ast.c
src/uci2_lexer.c
src/uci2_parser.c
)
# header files
set(UCI2_HEADERS
"src/libuci2.h"
"src/uci2_ast.h"
)
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${UCI2_HEADERS}")
# example programs
add_executable(example_check src/examples/example_check.c)
add_executable(example_new src/examples/example_new.c)
add_executable(example_new_ast src/examples/example_new_ast.c)
# det module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
# link examples
target_link_libraries(example_check ${PROJECT_NAME})
target_link_libraries(example_new ${PROJECT_NAME})
target_link_libraries(example_new_ast ${PROJECT_NAME})
# install libuci2
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION include)
# tests
if(ENABLE_TESTS)
find_package(CMOCKA REQUIRED)
enable_testing()
add_subdirectory(tests)
endif()