CMakeLists.txt

changeset 753
24dc84788dee
parent 701
72a440c437e9
equal deleted inserted replaced
752:aaad6674a1a3 753:24dc84788dee
1 cmake_minimum_required(VERSION 3.14)
2 project(ucx VERSION 3.0 DESCRIPTION "UAP Common Extensions" LANGUAGES C)
3
4 # Configuration
5 cmake_policy(SET CMP0077 NEW)
6 set(CMAKE_C_STANDARD 11)
7 set(CMAKE_C_STANDARD_REQUIRED 11)
8
9 option(GCC_MORE_WARNINGS "Enable -Wall -Wextra -pedantic when using gcc." OFF)
10 if (GCC_MORE_WARNINGS AND CMAKE_COMPILER_IS_GNUCC)
11 add_compile_options(-Wall -Wextra -pedantic)
12 endif()
13
14 # Library
15 add_subdirectory(src)
16
17 # Tests
18 include(CheckLanguage)
19 check_language(CXX)
20 if (CMAKE_CXX_COMPILER)
21 enable_language(CXX)
22 enable_testing()
23 add_subdirectory(tests)
24 else ()
25 message(STATUS "No C++ compiler found - tests are not compiled.")
26 endif ()
27
28 # Web Documentation
29 add_subdirectory(docs/src)
30
31 # API Documentation
32 message(CHECK_START "Seaching for Doxygen")
33 find_package(Doxygen)
34 if(DOXYGEN_FOUND)
35 message(CHECK_PASS "found.")
36 else()
37 message(CHECK_FAIL "not found - documentation will not be generated.")
38 endif()
39 option(BUILD_API_DOC "Create API documentation." ON)
40
41 if(BUILD_API_DOC AND DOXYGEN_FOUND)
42 set(DOXY_INPUT ${CMAKE_SOURCE_DIR}/src/cx)
43 set(DOXY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/docs)
44 set(DOXY_PROJECT_LOGO ${CMAKE_SOURCE_DIR}/uaplogo.png)
45
46 configure_file(${CMAKE_SOURCE_DIR}/cmake_infile.doxygen ${CMAKE_BINARY_DIR}/Doxyfile)
47
48 add_custom_target(docs-api-21
49 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/docs/api-2.1 ${CMAKE_BINARY_DIR}/docs/web/api-2.1
50 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
51 COMMENT "Copying UCX 2.1 API documentation.")
52
53 add_custom_target(docs-api
54 COMMAND ${DOXYGEN_EXECUTABLE}
55 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
56 COMMENT "Generating API documentation with Doxygen.")
57
58 add_custom_target(docs-all DEPENDS docs-html docs-api docs-api-21)
59 else()
60 add_custom_target(docs-all DEPENDS docs-html)
61 endif()
62

mercurial