Skip to content

Commit

Permalink
use FetchContent_MakeAvailable in date
Browse files Browse the repository at this point in the history
  • Loading branch information
martinzink committed Feb 20, 2024
1 parent efef3c2 commit 60e1484
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
35 changes: 2 additions & 33 deletions cmake/Date.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,39 +45,8 @@ if (WIN32)
COMPONENT bin)
endif()

FetchContent_Declare(date_src
FetchContent_Declare(date
URL https://github.com/HowardHinnant/date/archive/refs/tags/v3.0.1.tar.gz
URL_HASH SHA256=7a390f200f0ccd207e8cff6757e04817c1a0aec3e327b006b7eb451c57ee3538
)
FetchContent_GetProperties(date_src)
if (NOT date_src_POPULATED)
FetchContent_Populate(date_src)
set(DATE_INCLUDE_DIR "${date_src_SOURCE_DIR}/include" CACHE STRING "" FORCE)
add_library(date INTERFACE)
add_library(date::date ALIAS date)
target_sources(date INTERFACE ${DATE_INCLUDE_DIR}/date/date.h)
target_include_directories(date SYSTEM INTERFACE ${DATE_INCLUDE_DIR})
target_compile_features(date INTERFACE cxx_std_11)
if (NOT WIN32)
target_compile_options(date INTERFACE -Wno-error)
endif()

add_library(date-tz STATIC ${date_src_SOURCE_DIR}/src/tz.cpp)
add_library(date::tz ALIAS date-tz)
target_include_directories(date-tz SYSTEM PUBLIC ${DATE_INCLUDE_DIR})
target_compile_features(date-tz PUBLIC cxx_std_11)
target_compile_options(date-tz PRIVATE $<IF:$<CXX_COMPILER_ID:MSVC>,/w,-w>)
if (NOT WIN32)
target_compile_options(date-tz PRIVATE -Wno-error)
endif()
target_compile_definitions(date-tz PRIVATE AUTO_DOWNLOAD=0 HAS_REMOTE_API=0)
if (WIN32)
target_compile_definitions(date-tz PRIVATE INSTALL=. PUBLIC USE_OS_TZDB=0)
else()
target_compile_definitions(date-tz PUBLIC USE_OS_TZDB=1)
endif()
if (NOT MSVC)
find_package(Threads)
target_link_libraries(date-tz PUBLIC Threads::Threads)
endif()
endif()
FetchContent_MakeAvailable(date)
2 changes: 1 addition & 1 deletion libminifi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ endif()
include(RangeV3)
include(Asio)
include(MagicEnum)
list(APPEND LIBMINIFI_LIBRARIES yaml-cpp ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite libsodium range-v3 expected-lite date::date date::tz asio magic_enum)
list(APPEND LIBMINIFI_LIBRARIES yaml-cpp ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite libsodium range-v3 expected-lite date::date asio magic_enum)
if(NOT WIN32)
list(APPEND LIBMINIFI_LIBRARIES OSSP::libuuid++)
endif()
Expand Down

0 comments on commit 60e1484

Please sign in to comment.