forked from MFHava/PTL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (62 loc) · 2.89 KB
/
CMakeLists.txt
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
67
68
69
70
71
72
73
# Copyright Michael Florian Hava.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
cmake_minimum_required(VERSION 3.13)
project(PTL)
option(PTL_BUILD_TESTS "Build tests" OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/static)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_library(ptl_flags INTERFACE)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(ptl_flags INTERFACE -Wall -Wextra -Wpedantic -Wconversion)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_definitions(ptl_flags INTERFACE _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS _CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING)
target_compile_options(ptl_flags INTERFACE
/W4 /JMC /MP /permissive- /bigobj
/wd4003 # ignore not enough parameters for function macro
/wd4456 # ignore local shadowing
/wd4457 # ignore function parameter shadowing
/wd4458 # ignore class member shadowing
/wd4459 # ignore global shadowing
)
target_link_options(ptl_flags INTERFACE
/ignore:4099 # ignore mixing struct and class keyword for same type
)
endif()
add_library(ptl INTERFACE)
target_include_directories(ptl INTERFACE "inc")
target_link_libraries(ptl INTERFACE ptl_flags)
if(PTL_BUILD_TESTS)
find_package(Boost 1.59 REQUIRED unit_test_framework)
file(GLOB_RECURSE PTL "inc/*")
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/inc FILES ${PTL})
file(GLOB_RECURSE PTL_TEST "test/*")
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/test FILES ${PTL_TEST})
add_executable(test-ptl ${PTL} ${PTL_TEST}) #including PTL sources here to have them included in IDEs
target_compile_definitions(test-ptl PRIVATE PTL_ENABLE_DEBUGGING)
target_link_libraries(test-ptl ptl Boost::unit_test_framework)
set_target_properties(test-ptl PROPERTIES FOLDER "Portable Template Library")
endif()
find_package(Doxygen 1.8.2) #Doxygen 1.8.2 is the first version to support C++11
if(Doxygen_FOUND)
set(DOXYGEN_PROJECT_NAME "Portable Template Library")
set(DOXYGEN_PROJECT_BRIEF "A collection of binary stable types targeted at cross-compiler interop")
set(DOXYGEN_OUTPUT_DIRECTORY "docs")
set(DOXYGEN_BUILTIN_STL_SUPPORT YES)
set(DOXYGEN_SHOW_USED_FILES NO)
set(DOXYGEN_SHOW_FILES NO)
set(DOXYGEN_WARN_IF_UNDOCUMENTED NO)
set(DOXYGEN_FILE_PATTERNS "*.hpp")
set(DOXYGEN_EXCLUDE_SYMBOLS "ptl::internal;ptl::internal::*")
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_MACRO_EXPANSION YES)
set(DOXYGEN_COLLABORATION_GRAPH NO)
doxygen_add_docs(PTL-Documentation "inc;docs")
set_target_properties(PTL-Documentation PROPERTIES FOLDER "Portable Template Library")
endif()