This repository has been archived by the owner on May 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
78 lines (69 loc) · 2.35 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
74
75
76
77
78
cmake_minimum_required(VERSION 3.8)
project(formatxx
VERSION 0.10.0
LANGUAGES CXX
)
option(FORMATXX_BUILD_TESTS "Build formatxx tests" ON)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
add_subdirectory(external)
set(FORMATXX_PUBLIC_HEADERS
include/formatxx/format.h
include/formatxx/small_string.h
include/formatxx/std_string.h
include/formatxx/writers.h
)
set(FORMATXX_PRIVATE_HEADERS
include/formatxx/_detail/append_writer.h
include/formatxx/_detail/format_arg.h
include/formatxx/_detail/format_arg_impl.h
include/formatxx/_detail/format_impl.h
include/formatxx/_detail/format_traits.h
include/formatxx/_detail/format_util.h
include/formatxx/_detail/parse_format.h
include/formatxx/_detail/parse_printf.h
include/formatxx/_detail/parse_unsigned.h
include/formatxx/_detail/printf_impl.h
include/formatxx/_detail/write_float.h
include/formatxx/_detail/write_integer.h
include/formatxx/_detail/write_string.h
include/formatxx/_detail/write_wide.h
)
set(FORMATXX_SOURCES
source/format.cc
)
set(FORMATXX_TESTS
tests/main.cc
tests/test_format.cc
tests/test_printf.cc
tests/test_small_string.cc
tests/test_wide.cc
tests/test_writer.cc
)
set(FORMATXX_FILES ${FORMATXX_PUBLIC_HEADERS} ${FORMATXX_PRIVATE_HEADERS} ${FORMATXX_SOURCES})
add_library(formatxx ${FORMATXX_FILES})
target_compile_features(formatxx PUBLIC cxx_std_17)
target_include_directories(formatxx PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/formatxx>
)
target_link_libraries(formatxx PUBLIC litexx)
set_target_properties(formatxx PROPERTIES
DEFINE_SYMBOL FORMATXX_EXPORT
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
source_group("Header Files\\_detail" FILES ${FORMATXX_PRIVATE_HEADERS})
install(TARGETS formatxx EXPORT formatxx-targets
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include DESTINATION ${CMAKE_INSTALL_PREFIX})
install(EXPORT formatxx-targets DESTINATION share/formatxx/cmake)
export(TARGETS formatxx FILE formatxx-exports.cmake)
if(FORMATXX_BUILD_TESTS)
enable_testing()
add_executable(formatxx_tests ${FORMATXX_TESTS})
target_link_libraries(formatxx_tests formatxx doctest)
add_test(formatxx_tests formatxx_tests)
endif()