]> git.saurik.com Git - apt.git/blame - CMakeLists.txt
CMake: Translations: Pass some additional arguments to commands
[apt.git] / CMakeLists.txt
CommitLineData
f3de2dba
JAK
1# Copyright (C) 2009, 2016 Julian Andres Klode <jak@debian.org>.
2# Licensed under the same terms as APT; i.e. GPL 2 or later.
3
4# set minimum version
5project(apt)
6cmake_minimum_required(VERSION 3.3.0)
7
8option(WITH_DOC "Build documentation." OFF)
9option(USE_NLS "Localisation support." ON)
10
11set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake")
12
13# Work around bug in GNUInstallDirs
14if (EXISTS "/etc/debian_version")
15 set(CMAKE_INSTALL_LIBEXECDIR "lib")
16endif()
17
18# Include stuff
19include(Misc)
7def2482 20include(Translations)
f3de2dba
JAK
21include(CheckIncludeFiles)
22include(CheckFunctionExists)
23include(CheckStructHasMember)
24include(GNUInstallDirs)
25include(TestBigEndian)
26find_package(Threads)
27find_package(PkgConfig)
28
29# Set compiler flags
30set(CMAKE_CXX_STANDARD 11)
31set(CMAKE_CXX_STANDARD_REQUIRED ON)
32set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
33
34add_optional_compile_options(Wall)
35add_optional_compile_options(Wextra)
36add_optional_compile_options(Wcast-align)
37add_optional_compile_options(Wlogical-op)
38add_optional_compile_options(Wredundant-decls)
39add_optional_compile_options(Wmissing-declarations)
40add_optional_compile_options(Wunsafe-loop-optimizations)
41add_optional_compile_options(Wctor-dtor-privacy)
42add_optional_compile_options(Wdisabled-optimization)
43add_optional_compile_options(Winit-self)
44add_optional_compile_options(Wmissing-include-dirs)
45add_optional_compile_options(Wnoexcept)
46add_optional_compile_options(Wsign-promo)
47add_optional_compile_options(Wundef)
48
49# apt-ftparchive dependencies
50find_package(BerkeleyDB REQUIRED)
51if (BERKELEY_DB_FOUND)
52 set(HAVE_BDB 1)
53endif()
54
55
56# apt-transport-https dependencies
1ed5f979 57find_package(CURL REQUIRED)
f3de2dba
JAK
58if (CURL_FOUND)
59 set(HAVE_CURL 1)
60endif()
61
62# (De)Compressor libraries
63find_package(ZLIB REQUIRED)
64if (ZLIB_FOUND)
65 set(HAVE_ZLIB 1)
66endif()
67
68
69find_package(BZip2)
70if (BZIP2_FOUND)
71 set(HAVE_BZ2 1)
72endif()
73
74pkg_check_modules(LZMA liblzma)
75if (LZMA_FOUND)
76 set(HAVE_LZMA 1)
77endif()
78
79pkg_check_modules(LZ4 liblz4)
80if (LZ4_FOUND)
81 set(HAVE_LZ4 1)
82endif()
83
84# Mount()ing and stat()ing and friends
85
86check_function_exists(statvfs HAVE_STATVFS)
87if (NOT HAVE_STATVFS)
88 check_symbol_exists(statfs sys/vfs.h HAVE_VFS_H)
89 check_symbol_exists(statfs sys/mount.h HAVE_MOUNT_H)
90 if (NOT HAVE_VFS_H AND NOT HAVE_MOUNT_H)
91 message(FATAL_ERROR "Can find neither statvfs() nor statfs()")
92 endif()
93 configure_file(buildlib/statvfs.h.in ${PROJECT_BINARY_DIR}/include/statvfs.h @ONLY)
94endif()
95
96CHECK_STRUCT_HAS_MEMBER("struct statfs" f_type sys/vfs.h HAVE_STRUCT_STATFS_F_TYPE)
97
98# Other checks
99check_function_exists(getresuid HAVE_GETRESUID)
100check_function_exists(getresgid HAVE_GETRESGID)
101check_function_exists(setresuid HAVE_SETRESUID)
102check_function_exists(setresgid HAVE_SETRESGID)
103check_function_exists(timegm HAVE_TIMEGM)
104test_big_endian(WORDS_BIGENDIAN)
105
106if (CMAKE_USE_PTHREADS_INIT)
107 set(HAVE_PTHREAD 1)
108endif()
109
110# Configure some variables like package, version and architecture.
33ee08e4
JAK
111set(PACKAGE ${PROJECT_NAME})
112set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>")
f3de2dba
JAK
113
114execute_process(COMMAND dpkg-parsechangelog -SVersion -l${PROJECT_SOURCE_DIR}/debian/changelog
115 OUTPUT_VARIABLE PACKAGE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
116execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH
117 OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
118
119# Configure our configuration headers (config.h and apti18n.h)
120configure_file(CMake/config.h.in ${PROJECT_BINARY_DIR}/include/config.h)
121configure_file(CMake/apti18n.h.in ${PROJECT_BINARY_DIR}/include/apti18n.h)
122
123# Generic header locations
124include_directories(${PROJECT_BINARY_DIR}/include)
125
126# Add our subdirectories
127add_subdirectory(vendor)
128add_subdirectory(apt-pkg)
129add_subdirectory(apt-private)
130add_subdirectory(apt-inst)
131add_subdirectory(cmdline)
9a2aa0e7 132add_subdirectory(doc)
f3de2dba
JAK
133add_subdirectory(dselect)
134add_subdirectory(ftparchive)
135add_subdirectory(methods)
7def2482 136add_subdirectory(po)
dfd863ea 137add_subdirectory(test)