33#
44# SPDX-License-Identifier: MIT
55
6- # Works with 3.11 and tested through 3.15 (not tested yet)
7- cmake_minimum_required (VERSION 3.14 )
6+
7+ cmake_minimum_required (VERSION 3.26 )
88list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
99set (ALLOW_DUPLICATE_CUSTOM_TARGETS TRUE )
1010
11+ # Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
12+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0" )
13+ cmake_policy (SET CMP0135 NEW)
14+ endif ()
15+
1116project (CLIPPy
1217 VERSION 0.2
1318 DESCRIPTION "Command Line Interface Plus Python"
@@ -32,7 +37,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
3237 # Note this needs to be done in the main CMakeLists
3338 # since it calls enable_testing, which must be in the
3439 # main CMakeLists.
35- include (CTest)
40+ # include(CTest)
3641
3742 # Docs only available if this is the main app
3843 find_package (Doxygen)
@@ -72,26 +77,41 @@ endif()
7277
7378#
7479# Boost
75- set (BOOST_URL
76- "https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.tar.gz"
80+ # Download and build Boost::json
81+ set (BOOST_URL
82+ "https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.tar.gz"
7783 CACHE STRING "URL to fetch Boost tarball" )
7884
79- #
80- # Boost
85+
86+ set (BOOST_INCLUDE_LIBRARIES json lexical_cast range)
87+ set (BUILD_SHARED_LIBS ON )
8188FetchContent_Declare(
82- Boost
83- URL ${BOOST_URL}
84- )
85- set (BOOST_INCLUDE_LIBRARIES json)
89+ Boost
90+ URL ${BOOST_URL} )
8691FetchContent_MakeAvailable(Boost)
8792
93+
8894#
8995# JSONLogic
90- FetchContent_Declare(jsonlogic
91- GIT_REPOSITORY https://github.com/LLNL/jsonlogic.git
92- GIT_TAG master
93- )
94- FetchContent_MakeAvailable(jsonlogic)
96+ # find_package(jsonlogic QUIET)
97+ # if (NOT jsonlogic_FOUND)
98+ # message(STATUS "jsonlogic not found, doing stuff")
99+ set (Boost_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR} /boost-install ) # needed for jsonlogic
100+
101+ FetchContent_Declare(jsonlogic
102+ GIT_REPOSITORY https://github.com/LLNL/jsonlogic.git
103+ GIT_TAG master
104+ SOURCE_SUBDIR cpp
105+ )
106+ # set(jsonlogic_INCLUDE_DIR ${jsonlogic_SOURCE_DIR}/cpp/include/jsonlogic)
107+ FetchContent_MakeAvailable(jsonlogic)
108+ message (STATUS "jsonlogic source dir: ${jsonlogic_SOURCE_DIR} " )
109+
110+
111+ # else()
112+ # message(STATUS "jsonlogic found, weird")
113+
114+ # endif()
95115
96116### Require out-of-source builds
97117file (TO_CMAKE_PATH "${PROJECT_BINARY_DIR} /CMakeLists.txt" LOC_PATH)
@@ -106,9 +126,12 @@ option(TEST_WITH_SLURM "Run tests with Slurm" OFF)
106126# Header-only library, so likely not have src dir
107127# add_subdirectory(src)
108128
129+ message (STATUS "CMAKE_PROJECT_NAME: ${CMAKE_PROJECT_NAME} " )
130+ message (STATUS "PROJECT_NAME: ${PROJECT_NAME} " )
109131# Testing & examples are only available if this is the main app
110132# Emergency override MODERN_CMAKE_BUILD_TESTING provided as well
111133if ((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR MODERN_CMAKE_BUILD_TESTING) AND BUILD_TESTING)
134+ message (STATUS "adding test subdir" )
112135 add_subdirectory (test )
113136 # Example codes are here.
114137 #add_subdirectory(examples)
0 commit comments