-
Notifications
You must be signed in to change notification settings - Fork 20
/
CMakeLists.txt
71 lines (59 loc) · 1.91 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required (VERSION 3.1)
project (libacars C)
set (LA_VERSION_MAJOR 2)
set (LA_VERSION_MINOR 2)
set (LA_VERSION_PATCH 0)
set (LA_VERSION "${LA_VERSION_MAJOR}.${LA_VERSION_MINOR}.${LA_VERSION_PATCH}")
set (LA_SUBDIR "${PROJECT_NAME}-${LA_VERSION_MAJOR}")
set (CMAKE_C_STANDARD 11)
set (C_STANDARD_REQUIRED ON)
set (CMAKE_C_EXTENSIONS OFF)
include(GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Build type not specified: defaulting to Release")
endif(NOT CMAKE_BUILD_TYPE)
option(EMIT_ASN_DEBUG, "Enable debugging of ASN.1 decoder (requires
CMAKE_BUILD_TYPE=Debug" OFF)
if(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
endif()
if(MINGW)
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
endif()
include_directories (
${PROJECT_SOURCE_DIR}
)
add_subdirectory (libacars)
add_subdirectory (examples)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY
)
#only add uninstall target if this is the top project
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
# build a CPack driven installer package
include (InstallRequiredSystemLibraries)
set (CPACK_RESOURCE_FILE_LICENSE
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
set (CPACK_RESOURCE_FILE_README
"${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set (CPACK_PACKAGE_VERSION_MAJOR "${LA_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${LA_VERSION_MINOR}")
set (CPACK_PACKAGE_VERSION_PATCH "${LA_VERSION_PATCH}")
set (CPACK_PACKAGE_CHECKSUM "SHA256")
set (CPACK_STRIP_FILES TRUE)
if (UNIX)
set (CPACK_GENERATOR "TGZ")
elseif (WIN32)
set (CPACK_GENERATOR "ZIP")
endif ()
include (CPack)