UNIXworkcode

 1  cmake_minimum_required(VERSION 3.14)
 2  project(ucx VERSION 3.0 DESCRIPTION "UAP Common Extensions")
 3  
 4  # Configuration
 5  set(CMAKE_C_STANDARD 11)
 6  set(CMAKE_C_STANDARD_REQUIRED  99)
 7  
 8  option(GCC_MORE_WARNINGS "Enable -Wall -Wextra -pedantic when using gcc." OFF)
 9  if (GCC_MORE_WARNINGS AND CMAKE_COMPILER_IS_GNUCC)
10      add_compile_options(-Wall -Wextra -pedantic)
11  endif()
12  
13  # Library
14  add_subdirectory(src)
15  
16  # Tests
17  enable_testing()
18  add_subdirectory(test)
19  
20  # Web Documentation
21  add_subdirectory(docs/src)
22  
23  # API Documentation
24  message(CHECK_START "Seaching for Doxygen")
25  find_package(Doxygen)
26  if(DOXYGEN_FOUND)
27      message(CHECK_PASS "found.")
28  else()
29      message(CHECK_FAIL "not found - documentation will not be generated.")
30  endif()
31  option(BUILD_API_DOC "Create API documentation." ON)
32  
33  if(BUILD_API_DOC AND DOXYGEN_FOUND)
34      set(DOXY_INPUT ${CMAKE_SOURCE_DIR}/src/cx)
35      set(DOXY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/docs)
36      set(DOXY_PROJECT_LOGO ${CMAKE_SOURCE_DIR}/uaplogo.png)
37  
38      configure_file(${CMAKE_SOURCE_DIR}/cmake_infile.doxygen ${CMAKE_BINARY_DIR}/Doxyfile)
39  
40      add_custom_target(docs-api-21
41              COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/docs/api-2.1 ${CMAKE_BINARY_DIR}/docs/web/api-2.1
42              WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
43              COMMENT "Copying UCX 2.1 API documentation.")
44  
45      add_custom_target(docs-api
46              COMMAND ${DOXYGEN_EXECUTABLE}
47              WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
48              COMMENT "Generating API documentation with Doxygen.")
49  
50      add_custom_target(docs-all DEPENDS docs-html docs-api docs-api-21)
51  else()
52      add_custom_target(docs-all DEPENDS docs-html)
53  endif()
54