5
5
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6
6
7
7
cmake_minimum_required (VERSION 3.0 )
8
- project (callable_traits CXX )
8
+ project (boost_callable_traits CXX )
9
9
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
10
10
enable_testing ()
11
11
12
- set (CMAKE_CXX_STANDARD ${callable_traits_CXX_STD } )
12
+ set (CMAKE_CXX_STANDARD ${boost_callable_traits_CXX_STD } )
13
13
14
14
# Setting up CMake options and compiler flags (more flags can be set on a per-target basis or in subdirectories)
15
15
16
16
include (CheckCXXCompilerFlag )
17
- macro (callable_traits_append_flag testname flag )
17
+ macro (boost_callable_traits_append_flag testname flag )
18
18
check_cxx_compiler_flag (${flag} ${testname} )
19
19
if (${testname} )
20
20
add_compile_options (${flag} )
@@ -24,74 +24,84 @@ endmacro()
24
24
if (NOT MSVC OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
25
25
26
26
# enable all warnings and treat them all as errors
27
- callable_traits_append_flag ( callable_traits_HAS_WERROR -Werror )
28
- callable_traits_append_flag ( callable_traits_HAS_WX -WX )
29
- callable_traits_append_flag ( callable_traits_HAS_W -W )
30
- callable_traits_append_flag ( callable_traits_HAS_WALL -Wall )
31
- callable_traits_append_flag ( callable_traits_HAS_WEXTRA -Wextra )
27
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_WERROR -Werror )
28
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_WX -WX )
29
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_W -W )
30
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_WALL -Wall )
31
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_WEXTRA -Wextra )
32
32
endif ()
33
33
34
34
if (MSVC )
35
35
36
36
# MSVC/Clang-cl builds need -Qunused-arguments
37
- callable_traits_append_flag ( callable_traits_HAS_QUNUSED_ARGUMENTS -Qunused-arguments )
37
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_QUNUSED_ARGUMENTS -Qunused-arguments )
38
38
else ()
39
39
40
40
# for better template error debugging
41
- callable_traits_append_flag ( callable_traits_HAS_FTEMPLATE_BACKTRACE_LIMIT -ftemplate-backtrace-limit=0 )
41
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_FTEMPLATE_BACKTRACE_LIMIT -ftemplate-backtrace-limit=0 )
42
42
43
43
# enforce strict standards compliance
44
- callable_traits_append_flag ( callable_traits_HAS_PEDANTIC -pedantic )
44
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_PEDANTIC -pedantic )
45
45
46
46
# use the most recent C++ standard available
47
- callable_traits_append_flag ( callable_traits_HAS_STDCXX0x -std=c++0x )
48
- callable_traits_append_flag ( callable_traits_HAS_STDCXX1y -std=c++1y )
49
- callable_traits_append_flag ( callable_traits_HAS_STDCXX1z -std=c++1z )
50
- callable_traits_append_flag ( callable_traits_HAS_STDCXX17 -std=c++17 )
51
- callable_traits_append_flag ( callable_traits_HAS_STDCXX2a -std=c++2a )
47
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_STDCXX0x -std=c++0x )
48
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_STDCXX1y -std=c++1y )
49
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_STDCXX1z -std=c++1z )
50
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_STDCXX17 -std=c++17 )
51
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_STDCXX2a -std=c++2a )
52
52
endif ()
53
53
54
54
# transactional memory - currently only available in GCC 6 and later
55
55
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
56
- callable_traits_append_flag ( callable_traits_HAS_FGNU_TM -fgnu-tm )
56
+ boost_callable_traits_append_flag ( boost_callable_traits_HAS_FGNU_TM -fgnu-tm )
57
57
endif ()
58
58
59
+ add_library (boost_callable_traits INTERFACE )
60
+ set_property (TARGET boost_callable_traits PROPERTY EXPORT_NAME callable_traits )
61
+ add_library (Boost::callable_traits ALIAS boost_callable_traits )
62
+
63
+ target_include_directories (boost_callable_traits INTERFACE
64
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>"
65
+ $< INSTALL_INTERFACE:include> )
66
+
67
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
68
+
59
69
#
60
70
#find_package(Doxygen)
61
71
##find_package(Meta)
62
72
#find_package(PythonInterp 2.7)
63
73
#find_package(Ruby 2.1)
64
74
65
75
##############################################################################
66
- # callable_traits_target_name_for (<output variable> <source file> [ext])
76
+ # boost_callable_traits_target_name_for (<output variable> <source file> [ext])
67
77
# Returns the target name associated to a source file. If the path of the
68
- # source file relative from the root of callable_traits is `path/to/source/file.ext`,
78
+ # source file relative from the root of boost_callable_traits is `path/to/source/file.ext`,
69
79
# the target name associated to it will be `path.to.source.file`.
70
80
#
71
81
# The extension of the file should be specified as a last argument. If no
72
82
# extension is specified, the `.cpp` extension is assumed.
73
83
##############################################################################
74
84
75
- function (callable_traits_target_name_for out file )
85
+ function (boost_callable_traits_target_name_for out file )
76
86
if (NOT ARGV2 )
77
87
set (_extension ".cpp" )
78
88
else ()
79
89
set (_extension "${ARGV2} " )
80
90
endif ()
81
91
82
- file (RELATIVE_PATH _relative ${callable_traits_SOURCE_DIR } ${file} )
92
+ file (RELATIVE_PATH _relative ${boost_callable_traits_SOURCE_DIR } ${file} )
83
93
string (REPLACE "${_extension} " "" _name ${_relative} )
84
94
string (REGEX REPLACE "/" "." _name ${_name} )
85
95
set (${out} "${_name} " PARENT_SCOPE )
86
96
endfunction ()
87
97
88
98
##############################################################################
89
- # callable_traits_add_test (<name> <command> [<arg>...])
99
+ # boost_callable_traits_add_test (<name> <command> [<arg>...])
90
100
# Creates a test called `name`, which runs the given `command` with the given args.
91
101
##############################################################################
92
102
93
- function (callable_traits_add_test name )
94
- if (callable_traits_ENABLE_MEMCHECK )
103
+ function (boost_callable_traits_add_test name )
104
+ if (boost_callable_traits_ENABLE_MEMCHECK )
95
105
add_test (${name} ${Valgrind_EXECUTABLE} --leak-check=full --error-exitcode=1 ${ARGN} )
96
106
else ()
97
107
add_test (${name} ${ARGN} )
@@ -102,7 +112,6 @@ endfunction()
102
112
# Setup the `check` target to build and then run all the tests and examples.
103
113
##############################################################################
104
114
105
-
106
115
add_custom_target (callable_traits_check
107
116
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
108
117
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
@@ -119,10 +128,8 @@ add_subdirectory(test)
119
128
##############################################################################
120
129
# Setup the 'install' target and the package config file.
121
130
##############################################################################
122
- add_library (callable_traits INTERFACE )
123
- target_include_directories (callable_traits INTERFACE
124
- "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>"
125
- $< INSTALL_INTERFACE:include> )
126
- install (TARGETS callable_traits EXPORT CallableTraitsConfig )
131
+ install (TARGETS boost_callable_traits EXPORT CallableTraitsConfig )
127
132
install (EXPORT CallableTraitsConfig DESTINATION lib/cmake/CallableTraits )
128
133
install (DIRECTORY include /boost DESTINATION include FILES_MATCHING PATTERN "*.hpp" )
134
+
135
+ endif ()
0 commit comments