Adds option to force a build of protokit and select a specific commit

pull/15/head
Mark Jan van Kampen 2021-01-16 09:04:17 +01:00
parent 6444f236b8
commit 6a47beee63
No known key found for this signature in database
GPG Key ID: 942C8E0E0D996934
1 changed files with 13 additions and 2 deletions

View File

@ -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()