forked from AppImage/AppImageKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
105 lines (77 loc) · 2.38 KB
/
CMakeLists.txt
File metadata and controls
105 lines (77 loc) · 2.38 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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
cmake_minimum_required(VERSION 3.2)
project(AppImageKit)
include(ExternalProject)
# enable testing globally
include(CTest)
#####################
# build information #
#####################
# determine Git commit ID
execute_process(
COMMAND git describe --tags --always --abbrev=7
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# set version and build number
set(VERSION 1-alpha)
if("$ENV{TRAVIS_BUILD_NUMBER}" STREQUAL "")
set(BUILD_NUMBER "<local dev build>")
else()
set(BUILD_NUMBER "$ENV{TRAVIS_BUILD_NUMBER}")
endif()
# get current date
execute_process(
COMMAND env LC_ALL=C date -u "+%Y-%m-%d %H:%M:%S %Z"
OUTPUT_VARIABLE DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# C and C++ versions
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
##########################
# configure dependencies #
##########################
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# first of all, make sure required programs are available
function(check_program name)
string(TOUPPER ${name} name_upper)
find_program(${name_upper} ${name})
message(STATUS "Checking for program ${name}")
if(NOT ${name_upper})
message(FATAL_ERROR "Could not find required program ${name}.")
endif()
mark_as_advanced(${name_upper})
endfunction()
check_program(aclocal)
check_program(autoheader)
check_program(automake)
check_program(autoreconf)
check_program(libtoolize)
check_program(patch)
check_program(sed)
check_program(wget)
# TODO: add checks for remaining commands
# configure dependencies
include(cmake/dependencies.cmake)
# include directories globally
include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${CAIRO_INCLUDE_DIRS})
include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(${xz_INCLUDE_DIR})
include_directories(${inotify-tools_INCLUDE_DIR})
include_directories(${squashfuse_INCLUDE_DIR})
include_directories(${libarchive_INCLUDE_DIR})
################
# Source files #
################
# sanitizer support
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
add_subdirectory(src)
################################
# unit and functionality tests #
################################
add_subdirectory(tests)