Skip to content

Commit

Permalink
[CMake] add ENABLE_ switch for scitokens and macaroons, closes #1728.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Oct 4, 2022
1 parent 2b54ae8 commit ff67c2a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
2 changes: 2 additions & 0 deletions cmake/XRootDDefaults.cmake
Expand Up @@ -28,5 +28,7 @@ option( ENABLE_XRDEC "Enable erasure coding component."
option( ENABLE_ASAN "Enable adress sanitizer." FALSE )
option( ENABLE_TSAN "Enable thread sanitizer." FALSE )
option( ENABLE_XRDCLHTTP "Enable xrdcl-http plugin." TRUE )
option( ENABLE_SCITOKENS "Enable SciTokens plugin." TRUE )
option( ENABLE_MACAROONS "Enable Macaroons plugin." TRUE )
option( FORCE_ENABLED "Fail build if enabled components cannot be built." FALSE )
define_default( XRD_PYTHON_REQ_VERSION 3 )
48 changes: 32 additions & 16 deletions cmake/XRootDFindLibs.cmake
Expand Up @@ -119,25 +119,41 @@ check_function_exists( curl_multi_wait HAVE_CURL_MULTI_WAIT )
compiler_define_if_found( HAVE_CURL_MULTI_WAIT HAVE_CURL_MULTI_WAIT )
endif()

find_package( Macaroons )

if( NOT MacOSX )
include(FindPkgConfig REQUIRED)
pkg_check_modules(JSON json-c)
pkg_check_modules(UUID REQUIRED uuid)
if( ENABLE_MACAROONS )
if( FORCE_ENABLED )
find_package( Macaroons REQUIRED )
else()
find_package( Macaroons )
endif()
if( NOT MacOSX )
include(FindPkgConfig REQUIRED)
if( FORCE_ENABLED )
pkg_check_modules(JSON REQUIRED json-c)
pkg_check_modules(UUID REQUIRED uuid)
else()
pkg_check_modules(JSON json-c)
pkg_check_modules(UUID uuid)
endif()
endif()
if( MACAROONS_FOUND AND JSON_FOUND AND UUID_FOUND )
set( BUILD_MACAROONS TRUE )
else()
set( BUILD_MACAROONS FALSE )
endif()
endif()

if( MACAROONS_FOUND AND JSON_FOUND AND UUID_FOUND )
set( BUILD_MACAROONS TRUE )
else()
set( BUILD_MACAROONS FALSE )
endif()

find_package( SciTokensCpp )
if( SCITOKENSCPP_FOUND )
set( BUILD_SCITOKENS TRUE )
else()
set( BUILD_SCITOKENS FALSE )
if( ENABLE_SCITOKENS )
if( FORCE_ENABLED )
find_package( SciTokensCpp REQUIRED )
else()
find_package( SciTokensCpp )
endif()
if( SCITOKENSCPP_FOUND )
set( BUILD_SCITOKENS TRUE )
else()
set( BUILD_SCITOKENS FALSE )
endif()
endif()

if( ENABLE_XRDEC )
Expand Down

0 comments on commit ff67c2a

Please sign in to comment.