1 cmake_minimum_required(VERSION 3.2)
5 include(ExternalProject)
7 # enable testing globally
11 # call CMake with -DUSE_CCACHE=ON to make use of it
12 set(USE_CCACHE OFF CACHE BOOL "")
14 find_program(CCACHE ccache)
16 message(STATUS "Using ccache")
17 set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
18 set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
20 message(WARNING "USE_CCACHE set, but could not find ccache")
29 # determine Git commit ID
31 COMMAND git rev-parse --short HEAD
32 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
33 OUTPUT_VARIABLE GIT_COMMIT
34 OUTPUT_STRIP_TRAILING_WHITESPACE
37 # set version and build number
39 if("$ENV{TRAVIS_BUILD_NUMBER}" STREQUAL "")
40 set(BUILD_NUMBER "<local dev build>")
42 set(BUILD_NUMBER "$ENV{TRAVIS_BUILD_NUMBER}")
47 COMMAND env LC_ALL=C date -u "+%Y-%m-%d %H:%M:%S %Z"
49 OUTPUT_STRIP_TRAILING_WHITESPACE
53 set(CMAKE_C_STANDARD 99)
54 set(CMAKE_CXX_STANDARD 98)
55 set(CMAKE_C_STANDARD_REQUIRED ON)
56 set(CMAKE_CXX_STANDARD_REQUIRED ON)
57 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
59 # write version information for CPack to files
60 file(WRITE ${PROJECT_BINARY_DIR}/GIT_COMMIT "${GIT_COMMIT}")
63 ##########################
64 # configure dependencies #
65 ##########################
67 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
69 # first of all, make sure required programs are available
70 function(check_program name)
71 string(TOUPPER ${name} name_upper)
72 find_program(${name_upper} ${name})
74 message(STATUS "Checking for program ${name}")
77 message(FATAL_ERROR "Could not find required program ${name}.")
80 mark_as_advanced(${name_upper})
83 check_program(aclocal)
84 check_program(autoheader)
85 check_program(automake)
86 check_program(autoreconf)
87 check_program(libtoolize)
92 check_program(desktop-file-validate)
93 # TODO: add checks for remaining commands
96 # configure dependencies
97 include(cmake/dependencies.cmake)
100 # include directories globally
101 include_directories(${GLIB_INCLUDE_DIRS})
102 include_directories(${CAIRO_INCLUDE_DIRS})
103 include_directories(${ZLIB_INCLUDE_DIRS})
104 include_directories(${xz_INCLUDE_DIR})
105 include_directories(${inotify-tools_INCLUDE_DIR})
106 include_directories(${squashfuse_INCLUDE_DIR})
107 include_directories(${libarchive_INCLUDE_DIR})
115 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
117 add_subdirectory(src)
119 ################################
121 ################################
122 set(APPIMAGEKIT_PACKAGE_DEBS FALSE CACHE BOOL "")
124 if(APPIMAGEKIT_PACKAGE_DEBS)
125 include(cmake/cpack_debs.cmake)
128 ################################
129 # unit and functionality tests #
130 ################################
132 add_subdirectory(tests)