11cmake_minimum_required (VERSION 3.13 )
22
3- project (ublkcpp LANGUAGES CXX )
3+ # Version is defined once in the version header.
4+ set (UBLKCPP_VERSION_HEADER include/ublk/version.hpp)
5+ file (READ ${UBLKCPP_VERSION_HEADER} _ublkcpp_version_h )
6+ string (REGEX MATCH "#define UBLKCPP_VERSION_MAJOR ([0-9]+)" _ublkcpp_ver_m "${_ublkcpp_version_h} " )
7+ set (UBLKCPP_VERSION_MAJOR ${CMAKE_MATCH_1} )
8+ string (REGEX MATCH "#define UBLKCPP_VERSION_MINOR ([0-9]+)" _ublkcpp_ver_m "${_ublkcpp_version_h} " )
9+ set (UBLKCPP_VERSION_MINOR ${CMAKE_MATCH_1} )
10+ set (UBLKCPP_VERSION_STRING "v${UBLKCPP_VERSION_MAJOR} .${UBLKCPP_VERSION_MINOR} " )
11+
12+ project (ublkcpp VERSION ${UBLKCPP_VERSION_MAJOR} .${UBLKCPP_VERSION_MINOR} LANGUAGES CXX )
13+ message (STATUS "Configuring ublkcpp ${UBLKCPP_VERSION_STRING} " )
414
515option (UBLKCPP_BUILD_TESTS "Build tests" OFF )
616option (UBLKCPP_BUILD_UBLKCTL "Build ublkctl" OFF )
717option (UBLKCPP_BUILD_EXAMPLES "Build examples" OFF )
18+ option (UBLKCPP_BUILD_DOCS "Build Doxygen documentation" OFF )
819option (UBLKCPP_USE_URING_CMD128 "Use IORING_OP_URING_CMD128 for control commands" ON )
920option (UBLKCPP_TESTS_STATIC_LINK "Use static linking for tests" OFF )
1021option (UBLKCPP_TESTS_ASAN "Enable address and undefined behavior sanitizers for tests" OFF )
@@ -13,6 +24,7 @@ include(FetchContent)
1324
1425set (DOCTEST_VERSION v2.5.0)
1526set (CLI11_VERSION v2.7.2)
27+ set (DOXYGEN_AWESOME_CSS_VERSION v2.4.1)
1628
1729FetchContent_Declare (
1830 doctest
@@ -24,6 +36,11 @@ FetchContent_Declare(
2436 URL https://github.com/CLIUtils/CLI11/releases/download/${CLI11_VERSION} /CLI11.hpp
2537 DOWNLOAD_NO_EXTRACT TRUE
2638)
39+ FetchContent_Declare (
40+ doxygen-awesome-css
41+ URL https://raw.githubusercontent.com/jothepro/doxygen-awesome-css/${DOXYGEN_AWESOME_CSS_VERSION} /doxygen-awesome.css
42+ DOWNLOAD_NO_EXTRACT TRUE
43+ )
2744
2845add_library (ublkcpp INTERFACE )
2946target_include_directories (ublkcpp INTERFACE include )
@@ -51,3 +68,8 @@ if(UBLKCPP_BUILD_EXAMPLES)
5168 message (STATUS "Configuring examples in ${CMAKE_CURRENT_SOURCE_DIR } /examples" )
5269 add_subdirectory (examples )
5370endif ()
71+
72+ if (UBLKCPP_BUILD_DOCS)
73+ message (STATUS "Configuring docs in ${CMAKE_CURRENT_SOURCE_DIR } /docs" )
74+ add_subdirectory (docs )
75+ endif ()
0 commit comments