From d907f58577d5fb45a7cdd0d97c2a930ae7ad7ab0 Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Thu, 29 Sep 2022 11:00:02 +0200 Subject: [PATCH 1/2] build: add doc target This new target, only available if Doxygen is found on the build machine, generates Doxygen documentation with CMake's doxygen_add_docs() --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a7d14a..0a10902 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,6 +215,19 @@ install(EXPORT "zycore-targets" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/zycore") install(DIRECTORY "include/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +# =============================================================================================== # +# Doxygen documentation # +# =============================================================================================== # +find_package(Doxygen) +if (DOXYGEN_FOUND) + doxygen_add_docs(doc "include/Zycore/" ALL) + install( + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/" + DESTINATION "${CMAKE_INSTALL_DOCDIR}/api" + COMPONENT Documentation + ) +endif() + # =============================================================================================== # # Developer mode # # =============================================================================================== # From e583b27075c868077fd7cfb14f6686d381511c42 Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Thu, 29 Sep 2022 11:04:23 +0200 Subject: [PATCH 2/2] build: only enable CXX if needed This allows building Zycore when only a C compiler is installed --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a10902..5defca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ endif () cmake_minimum_required(VERSION 3.9 FATAL_ERROR) -project(Zycore VERSION 1.2.0.0 LANGUAGES C CXX) +project(Zycore VERSION 1.2.0.0 LANGUAGES C) include(GNUInstallDirs) include(CMakePackageConfigHelpers) @@ -276,6 +276,7 @@ function (zyan_add_test test) endfunction () if (ZYCORE_BUILD_TESTS) + enable_language(CXX) enable_testing() zyan_add_test("String") zyan_add_test("Vector")