/cmake-modules

CMake modules used by Measurement Kit

Primary LanguageCMakeBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Useful CMake Modules

⚠️⚠️⚠️⚠️⚠️⚠️⚠️: Deprecated and archived repository!

This repository contains CMake modules used within Measurement Kit.

Usage

  1. embed it as a git submodule into your sources tree:
git submodule add https://github.com/measurement-kit/cmake-modules cmake/Modules
  1. modify your CMakeLists.txt to use this submodule:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
include(MkUtils)
  1. use it whenever appropriate

Synopsis

function(MkDownloadAdishavitArgh)

Downloads the latest version of github.com/adishavit/argh.

function(MkDownloadCaBundle)

Download CURL's CA bundle.

function(MkDownloadHowardHinnantDate)

Downloads the latest version of github.com/HowardHinnant/date.

function(MkDownloadMMDBDatabases)

Download MaxMind's MMDB GeoLite2 databases.

function(MkDownloadNlohmannJson)

Downloads the latest version of github.com/nlohmann/json.

function(MkDownloadCatchorgCatch2)

Downloads the latest version of github.com/catchorg/Catch2.

function(MkDownloadMeasurementKitMkBouncer)

Downloads the github.com/measurement-kit/mkbouncer header only library.

function(MkDownloadMeasurementKitMkCollector)

Downloads the github.com/measurement-kit/mkcollector header only library.

function(MkDownloadMeasurementKitMkData)

Downloads the github.com/measurement-kit/mkdata header only library.

function(MkDownloadMeasurementKitMkMock)

Downloads the github.com/measurement-kit/mkmock header only library.

function(MkDownloadMeasurementKitMkCurl)

Downloads the github.com/measurement-kit/mkcurl header only library.

function(MkDownloadMeasurementKitMkIPLookup)

Downloads the github.com/measurement-kit/mkiplookup header only library.

function(MkDownloadMeasurementKitMkMMDB)

Downloads the github.com/measurement-kit/mkmmdb header only library.

function(MkDownloadMeasurementKitPrebuiltWindowsCurl)

Downloads a recent version of github.com/curl/curl precompiled by us for the MSVC compiler. As such, this code should only be executed when compiling for MSVC.

We do not guarantee that such version of CURL is current. We only use that for running regression tests on AppVeyor.

The archive will be downloaded and extracted in the current binary directory creating a MK_DIST/windows/curl/$version/$arch tree.

Sets the following variables:

  • MK_WINDOWS_CURL_INCLUDE_PATH, to be added to CMAKE_INCLUDE_PATH;

  • MK_WINDOWS_CURL_LIBRARY_PATH, to be added to CMAKE_LIBRARY_PATH;

  • MK_WINDOWS_CURL_DEFINITIONS, to be passed to add_definitions();

  • MK_WINDOWS_CURL_EXTRA_LINK_LIBS, extra libraries to be linked when linking with cURL, which is static, hence we need to specify these required libraries explicitly.

function(MkDownloadMeasurementKitPrebuiltWindowsLibmaxminddb)

Downloads a recent version of github.com/maxmind/libmaxminddb precompiled by us for the MSVC compiler. As such, this code should only be executed when compiling for MSVC.

We do not guarantee that the downloaded software is the latest version since we only use it for running tests on AppVeyor.

The archive will be downloaded and extracted in the current binary directory creating a MK_DIST/windows/libmaxminddb/$version/$arch tree.

Sets the following variables:

  • MK_WINDOWS_LIBMAXMINDDB_INCLUDE_PATH, to be added to CMAKE_INCLUDE_PATH;

  • MK_WINDOWS_LIBMAXMINDDB_LIBRARY_PATH, to be added to CMAKE_LIBRARY_PATH;

macro(MkSetCompilerFlags)

Tweaks the compiler flags (both for C++ and C) as follows:

  • require a threading library

  • set position independent code

  • require C++11 and C11

  • reject any compiler that is not GCC, Clang, or MSVC

  • with GCC and Clang, set -Wall -Wextra -Werror as well as other useful warnings and hardening flags

  • with MSVC, set /WX /W4 /Wall /analyze and require Windows >= Vista