2020-05-27 23:03:36 +02:00
|
|
|
# -*- mode: cmake; -*-
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(nix CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
2020-05-29 23:31:07 +02:00
|
|
|
# Export compile_commands.json which can be used by tools such as
|
|
|
|
# clangd and clang-tidy.
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
2020-06-21 18:20:59 +02:00
|
|
|
# Provide an output path for pkgconfig.
|
|
|
|
include(GNUInstallDirs)
|
2020-06-21 18:23:08 +02:00
|
|
|
set(PKGCONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
2020-06-21 18:20:59 +02:00
|
|
|
|
2020-05-27 23:03:36 +02:00
|
|
|
# The following lines import CMake-native dependencies which may
|
|
|
|
# contain useful definitions. Other dependencies are not treated
|
|
|
|
# specially by CMake and are only linked into the resulting binary.
|
|
|
|
find_package(BZip2)
|
2020-07-05 21:02:10 +02:00
|
|
|
find_package(Boost COMPONENTS context)
|
2020-05-27 23:03:36 +02:00
|
|
|
find_package(CURL)
|
2020-07-05 18:46:01 +02:00
|
|
|
find_package(LibLZMA)
|
2020-07-05 21:02:10 +02:00
|
|
|
find_package(Protobuf REQUIRED)
|
2020-05-27 23:03:36 +02:00
|
|
|
find_package(SQLite3)
|
|
|
|
find_package(Threads)
|
2020-07-05 18:37:36 +02:00
|
|
|
find_package(absl REQUIRED)
|
2020-07-05 21:02:10 +02:00
|
|
|
find_package(gRPC REQUIRED)
|
2020-07-05 18:46:01 +02:00
|
|
|
find_package(glog REQUIRED)
|
2020-05-29 22:51:29 +02:00
|
|
|
|
2020-05-27 23:03:36 +02:00
|
|
|
# generate a configuration file (autoheader-style) to configure
|
|
|
|
# certain symbols that Nix depends on.
|
|
|
|
configure_file(config.h.in nix_config.h @ONLY)
|
2020-06-21 22:40:55 +02:00
|
|
|
INSTALL(FILES "${PROJECT_BINARY_DIR}/nix_config.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nix")
|
|
|
|
|
|
|
|
# install corepkgs
|
|
|
|
configure_file(corepkgs/config.nix.in config.nix @ONLY)
|
|
|
|
INSTALL(DIRECTORY corepkgs
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/nix
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.nix")
|
|
|
|
INSTALL(FILES "${PROJECT_BINARY_DIR}/config.nix" DESTINATION "${CMAKE_INSTALL_DATADIR}/nix/corepkgs")
|
2020-05-27 23:03:36 +02:00
|
|
|
|
2020-07-17 03:19:21 +02:00
|
|
|
# Conditionally run tests
|
|
|
|
option(PACKAGE_TESTS "Build the tests" ON)
|
|
|
|
if (PACKAGE_TESTS)
|
|
|
|
enable_testing()
|
|
|
|
find_package(GTest)
|
2020-07-19 06:36:22 +02:00
|
|
|
find_package(rapidcheck)
|
2020-07-17 03:19:21 +02:00
|
|
|
include(GoogleTest)
|
|
|
|
endif()
|
|
|
|
|
2020-05-27 23:03:36 +02:00
|
|
|
add_subdirectory(src)
|