-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
41 lines (31 loc) · 1.22 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
cmake_minimum_required(VERSION 2.8)
project(yaml-path C)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(FindPkgConfig)
pkg_check_modules(YAML yaml-0.1)
find_package(codecov)
include_directories(${YAML_INCLUDE_DIRS} src)
add_library(yaml-path src/yaml-path.c)
target_link_libraries(yaml-path ${YAML_LIBRARIES})
add_coverage(yaml-path)
add_executable(yamlp src/yamlp.c)
target_link_libraries(yamlp yaml-path)
add_coverage(yamlp)
install(TARGETS yamlp RUNTIME DESTINATION bin)
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -std=c99 -W -Wall -Wnonnull -Wshadow -Wformat -Wundef -Wno-unused-parameter -Wmissing-prototypes -Wno-unknown-pragmas -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L")
endif()
if(${CMAKE_SYSTEM_NAME} EQUAL "Solaris")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__EXTENSIONS__")
endif()
if(WIN32)
# Expose new WinAPI function appearing on Windows 7 (e.g. inet_pton)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WIN32_WINNT=0x0600")
endif()
if(APPLE)
# Full Single Unix Standard v3 (SUSv3) conformance (the Unix API)
add_definitions(-D_DARWIN_C_SOURCE)
endif()
enable_testing()
add_subdirectory("tests")
coverage_evaluate()