From 6a47beee63f8dc1a00307d5f394f64a34e1d9715 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Sat, 16 Jan 2021 09:04:17 +0100 Subject: [PATCH] Adds option to force a build of protokit and select a specific commit --- CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a65c3d9..78eded3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ project(norm VERSION 1.5.8) set(COMMON src/common) option(NORM_BUILD_EXAMPLES "Enables building of the examples in /examples." OFF) +option(NORM_FORCE_BUILD_PROTOKIT "Enables forced build of protokit." OFF) +option(NORM_USE_LATEST_PROTOKIT "Enables the use of the latest protokit version." OFF) include(CheckCXXSymbolExists) check_cxx_symbol_exists(dirfd "dirent.h" HAVE_DIRFD) @@ -23,15 +25,24 @@ if(HAVE_FLOCK) list(APPEND PLATFORM_DEFINITIONS HAVE_FLOCK) endif() +if(NORM_USE_LATEST_PROTOKIT) + set(NORM_PROTOKIT_GIT_TAG origin/master) +else() + set(NORM_PROTOKIT_GIT_TAG fbe1c747933cfd8c85e03035eabb6d28c7c758b5) +endif() + # Check for libraries -find_package(protokit QUIET) +if(NOT NORM_FORCE_BUILD_PROTOKIT AND NOT NORM_USE_LATEST_PROTOKIT) + find_package(protokit) +endif() if(NOT protokit_FOUND) + message(STATUS "Building protokit from ${NORM_PROTOKIT_GIT_TAG}") include(FetchContent) FetchContent_Declare( protokit GIT_REPOSITORY https://github.com/USNavalResearchLaboratory/protolib.git - GIT_TAG origin/master + GIT_TAG ${NORM_PROTOKIT_GIT_TAG} ) FetchContent_MakeAvailable(protokit) endif()