make C++ compiler and pandoc entirely optional

Sun, 03 Sep 2023 09:10:16 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 03 Sep 2023 09:10:16 +0200
changeset 752
aaad6674a1a3
parent 751
9c104f2f1327
child 753
24dc84788dee

make C++ compiler and pandoc entirely optional

CMakeLists.txt file | annotate | diff | comparison | revisions
docs/src/CMakeLists.txt file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Sun Jul 09 12:43:13 2023 +0200
+++ b/CMakeLists.txt	Sun Sep 03 09:10:16 2023 +0200
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.14)
-project(ucx VERSION 3.0 DESCRIPTION "UAP Common Extensions")
+project(ucx VERSION 3.0 DESCRIPTION "UAP Common Extensions" LANGUAGES C)
 
 # Configuration
 cmake_policy(SET CMP0077 NEW)
@@ -15,8 +15,15 @@
 add_subdirectory(src)
 
 # Tests
-enable_testing()
-add_subdirectory(tests)
+include(CheckLanguage)
+check_language(CXX)
+if (CMAKE_CXX_COMPILER)
+    enable_language(CXX)
+    enable_testing()
+    add_subdirectory(tests)
+else ()
+    message(STATUS "No C++ compiler found - tests are not compiled.")
+endif ()
 
 # Web Documentation
 add_subdirectory(docs/src)
--- a/docs/src/CMakeLists.txt	Sun Jul 09 12:43:13 2023 +0200
+++ b/docs/src/CMakeLists.txt	Sun Sep 03 09:10:16 2023 +0200
@@ -34,7 +34,7 @@
 if (NOT EXISTS ${PANDOC_EXECUTABLE})
     find_program(PANDOC_EXECUTABLE pandoc)
     if(NOT EXISTS ${PANDOC_EXECUTABLE})
-        message(WARNING "Pandoc not found, docs-html target will not be generated.")
+        message(STATUS "Pandoc not found, docs-html target will not be generated.")
         return()
     endif()
 endif()

mercurial