File: CMakeLists.txt

package info (click to toggle)
msgpuck 1.0.3-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 384 kB
  • ctags: 393
  • sloc: ansic: 2,721; makefile: 12
file content (66 lines) | stat: -rw-r--r-- 2,355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
project(msgpuck)
cmake_minimum_required(VERSION 2.8.5)

if(POLICY CMP0037)
    cmake_policy(SET CMP0037 OLD) # don't blame custom target names
endif(POLICY CMP0037)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -fstrict-aliasing")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -pg -Wall -Wextra -Wcast-align -Werror")

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Debug CACHE STRING
        "Build type, options are: Debug Release." FORCE)
endif()

include(CheckCCompilerFlag)
check_c_compiler_flag("-mno-unaligned-access" CC_HAS_MNO_UNALIGNED_ACCESS)

include(GNUInstallDirs)

add_subdirectory(test)

add_library(${PROJECT_NAME} STATIC msgpuck.c)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0 SOVERSION 1)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "msgpuck")

install(TARGETS ${PROJECT_NAME}
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    COMPONENT library)

install(FILES msgpuck.h DESTINATION include)

find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
    return()
endif()

set(GENERATE_HTML "NO")
set(GENERATE_MAN "YES")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in"
               "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.man")
add_custom_command(OUTPUT doc/man/man3/msgpuck.h.3
    COMMAND ${CMAKE_COMMAND} -E make_directory doc/man
    COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.man"
    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    DEPENDS msgpuck.h
    COMMENT "Generating man pages" VERBATIM)
add_custom_target(man DEPENDS doc/man/man3/msgpuck.h.3)

set(GENERATE_HTML "YES")
set(GENERATE_MAN "NO")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in"
               "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.html")
add_custom_command(OUTPUT doc/html/index.html
    COMMAND ${CMAKE_COMMAND} -E make_directory doc/html
    COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.html"
    COMMAND ${CMAKE_COMMAND} -E rename doc/html/msgpuck_8h.html
                                       doc/html/index.html
    COMMAND sed s/msgpuck_8h\\.html/index\\.html/ -i doc/html/index.html
    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    DEPENDS msgpuck.h
    COMMENT "Generating html documentation" VERBATIM)
add_custom_target(html DEPENDS doc/html/index.html)

add_custom_target(doc DEPENDS man html)