| a0630906 |
Poul Sander |
2022-01-15 13:59 |
1 |
add_subdirectory(gtest) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
2 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
3 |
set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
4 |
add_library(test-main STATIC ${TEST_MAIN_SRC}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
5 |
target_include_directories(test-main PUBLIC |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
6 |
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
7 |
target_link_libraries(test-main gtest) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
8 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
9 |
include(CheckCXXCompilerFlag) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
10 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
11 |
function(add_fmt_executable name) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
12 |
add_executable(${name} ${ARGN}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
13 |
if (MINGW) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
14 |
target_link_libraries(${name} -static-libgcc -static-libstdc++) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
15 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
16 |
# (Wstringop-overflow) - [meta-bug] bogus/missing -Wstringop-overflow warnings |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
17 |
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443 |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
18 |
# Bogus -Wstringop-overflow warning |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
19 |
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100395 |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
20 |
# [10 Regression] spurious -Wstringop-overflow writing to a trailing array plus offset |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
21 |
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95353 |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
22 |
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
23 |
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
24 |
target_link_libraries(${name} -Wno-stringop-overflow) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
25 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
26 |
endfunction() |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
27 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
28 |
# Adds a test. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
29 |
# Usage: add_fmt_test(name srcs...) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
30 |
function(add_fmt_test name) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
31 |
cmake_parse_arguments(ADD_FMT_TEST "HEADER_ONLY;MODULE" "" "" ${ARGN}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
32 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
33 |
set(sources ${name}.cc ${ADD_FMT_TEST_UNPARSED_ARGUMENTS}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
34 |
if (ADD_FMT_TEST_HEADER_ONLY) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
35 |
set(sources ${sources} ${TEST_MAIN_SRC} ../src/os.cc) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
36 |
set(libs gtest fmt-header-only) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
37 |
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
38 |
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wno-weak-vtables) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
39 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
40 |
elseif (ADD_FMT_TEST_MODULE) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
41 |
set(libs gtest test-module) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
42 |
set_source_files_properties(${name}.cc PROPERTIES OBJECT_DEPENDS test-module) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
43 |
else () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
44 |
set(libs test-main fmt) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
45 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
46 |
add_fmt_executable(${name} ${sources}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
47 |
target_link_libraries(${name} ${libs}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
48 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
49 |
# Define if certain C++ features can be used. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
50 |
if (FMT_PEDANTIC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
51 |
target_compile_options(${name} PRIVATE ${PEDANTIC_COMPILE_FLAGS}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
52 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
53 |
if (FMT_WERROR) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
54 |
target_compile_options(${name} PRIVATE ${WERROR_FLAG}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
55 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
56 |
add_test(NAME ${name} COMMAND ${name}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
57 |
endfunction() |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
58 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
59 |
add_fmt_test(args-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
60 |
add_fmt_test(assert-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
61 |
add_fmt_test(chrono-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
62 |
add_fmt_test(color-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
63 |
add_fmt_test(core-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
64 |
add_fmt_test(gtest-extra-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
65 |
add_fmt_test(format-test mock-allocator.h) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
66 |
if (MSVC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
67 |
target_compile_options(format-test PRIVATE /bigobj) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
68 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
69 |
if (NOT (MSVC AND BUILD_SHARED_LIBS)) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
70 |
add_fmt_test(format-impl-test HEADER_ONLY header-only-test.cc) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
71 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
72 |
add_fmt_test(ostream-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
73 |
add_fmt_test(compile-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
74 |
add_fmt_test(compile-fp-test HEADER_ONLY) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
75 |
if (MSVC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
76 |
# Without this option, MSVC returns 199711L for the __cplusplus macro. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
77 |
target_compile_options(compile-fp-test PRIVATE /Zc:__cplusplus) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
78 |
endif() |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
79 |
add_fmt_test(printf-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
80 |
add_fmt_test(ranges-test ranges-odr-test.cc) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
81 |
add_fmt_test(scan-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
82 |
add_fmt_test(unicode-test HEADER_ONLY) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
83 |
if (MSVC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
84 |
target_compile_options(unicode-test PRIVATE /utf-8) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
85 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
86 |
add_fmt_test(xchar-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
87 |
add_fmt_test(enforce-checks-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
88 |
target_compile_definitions(enforce-checks-test PRIVATE |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
89 |
-DFMT_ENFORCE_COMPILE_STRING) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
90 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
91 |
if (FMT_CAN_MODULE) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
92 |
# The tests need {fmt} to be compiled as traditional library |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
93 |
# because of visibility of implementation details. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
94 |
# If module support is present the module tests require a |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
95 |
# test-only module to be built from {fmt} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
96 |
add_library(test-module OBJECT ${CMAKE_SOURCE_DIR}/src/fmt.cc) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
97 |
target_compile_features(test-module PUBLIC ${FMT_REQUIRED_FEATURES}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
98 |
target_include_directories(test-module PUBLIC |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
99 |
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
100 |
enable_module(test-module) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
101 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
102 |
add_fmt_test(module-test MODULE test-main.cc) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
103 |
if (MSVC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
104 |
target_compile_options(test-module PRIVATE /utf-8 /Zc:__cplusplus |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
105 |
/Zc:externConstexpr /Zc:inline) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
106 |
target_compile_options(module-test PRIVATE /utf-8 /Zc:__cplusplus |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
107 |
/Zc:externConstexpr /Zc:inline) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
108 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
109 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
110 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
111 |
if (NOT DEFINED MSVC_STATIC_RUNTIME AND MSVC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
112 |
foreach (flag_var |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
113 |
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
114 |
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
115 |
if (${flag_var} MATCHES "^(/|-)(MT|MTd)") |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
116 |
set(MSVC_STATIC_RUNTIME ON) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
117 |
break() |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
118 |
endif() |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
119 |
endforeach() |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
120 |
endif() |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
121 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
122 |
if (NOT MSVC_STATIC_RUNTIME) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
123 |
add_fmt_executable(posix-mock-test |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
124 |
posix-mock-test.cc ../src/format.cc ${TEST_MAIN_SRC}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
125 |
target_include_directories( |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
126 |
posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR}/include) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
127 |
target_link_libraries(posix-mock-test gtest) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
128 |
if (FMT_PEDANTIC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
129 |
target_compile_options(posix-mock-test PRIVATE ${PEDANTIC_COMPILE_FLAGS}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
130 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
131 |
if (HAVE_STRTOD_L) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
132 |
target_compile_definitions(posix-mock-test PRIVATE FMT_LOCALE) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
133 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
134 |
add_test(NAME posix-mock-test COMMAND posix-mock-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
135 |
add_fmt_test(os-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
136 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
137 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
138 |
message(STATUS "FMT_PEDANTIC: ${FMT_PEDANTIC}") |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
139 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
140 |
if (FMT_PEDANTIC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
141 |
# Test that the library can be compiled with exceptions disabled. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
142 |
# -fno-exception is broken in icc: https://github.com/fmtlib/fmt/issues/822. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
143 |
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
144 |
check_cxx_compiler_flag(-fno-exceptions HAVE_FNO_EXCEPTIONS_FLAG) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
145 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
146 |
if (HAVE_FNO_EXCEPTIONS_FLAG) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
147 |
add_library(noexception-test ../src/format.cc noexception-test.cc) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
148 |
target_include_directories( |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
149 |
noexception-test PRIVATE ${PROJECT_SOURCE_DIR}/include) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
150 |
target_compile_options(noexception-test PRIVATE -fno-exceptions) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
151 |
if (FMT_PEDANTIC) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
152 |
target_compile_options(noexception-test PRIVATE ${PEDANTIC_COMPILE_FLAGS}) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
153 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
154 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
155 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
156 |
# Test that the library compiles without locale. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
157 |
add_library(nolocale-test ../src/format.cc) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
158 |
target_include_directories( |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
159 |
nolocale-test PRIVATE ${PROJECT_SOURCE_DIR}/include) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
160 |
target_compile_definitions( |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
161 |
nolocale-test PRIVATE FMT_STATIC_THOUSANDS_SEPARATOR=1) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
162 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
163 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
164 |
# These tests are disabled on Windows because they take too long. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
165 |
if (FMT_PEDANTIC AND NOT WIN32) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
166 |
# Test if incorrect API usages produce compilation error. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
167 |
add_test(compile-error-test ${CMAKE_CTEST_COMMAND} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
168 |
--build-and-test |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
169 |
"${CMAKE_CURRENT_SOURCE_DIR}/compile-error-test" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
170 |
"${CMAKE_CURRENT_BINARY_DIR}/compile-error-test" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
171 |
--build-generator ${CMAKE_GENERATOR} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
172 |
--build-makeprogram ${CMAKE_MAKE_PROGRAM} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
173 |
--build-options |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
174 |
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
175 |
"-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
176 |
"-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
177 |
"-DFMT_DIR=${CMAKE_SOURCE_DIR}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
178 |
"-DSUPPORTS_USER_DEFINED_LITERALS=${SUPPORTS_USER_DEFINED_LITERALS}") |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
179 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
180 |
# Test if the targets are found from the build directory. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
181 |
add_test(find-package-test ${CMAKE_CTEST_COMMAND} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
182 |
-C ${CMAKE_BUILD_TYPE} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
183 |
--build-and-test |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
184 |
"${CMAKE_CURRENT_SOURCE_DIR}/find-package-test" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
185 |
"${CMAKE_CURRENT_BINARY_DIR}/find-package-test" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
186 |
--build-generator ${CMAKE_GENERATOR} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
187 |
--build-makeprogram ${CMAKE_MAKE_PROGRAM} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
188 |
--build-options |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
189 |
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
190 |
"-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
191 |
"-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
192 |
"-DFMT_DIR=${PROJECT_BINARY_DIR}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
193 |
"-DPEDANTIC_COMPILE_FLAGS=${PEDANTIC_COMPILE_FLAGS}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
194 |
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
195 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
196 |
# Test if the targets are found when add_subdirectory is used. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
197 |
add_test(add-subdirectory-test ${CMAKE_CTEST_COMMAND} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
198 |
-C ${CMAKE_BUILD_TYPE} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
199 |
--build-and-test |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
200 |
"${CMAKE_CURRENT_SOURCE_DIR}/add-subdirectory-test" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
201 |
"${CMAKE_CURRENT_BINARY_DIR}/add-subdirectory-test" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
202 |
--build-generator ${CMAKE_GENERATOR} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
203 |
--build-makeprogram ${CMAKE_MAKE_PROGRAM} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
204 |
--build-options |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
205 |
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
206 |
"-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
207 |
"-DPEDANTIC_COMPILE_FLAGS=${PEDANTIC_COMPILE_FLAGS}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
208 |
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
209 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
210 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
211 |
# This test are disabled on Windows because it is only *NIX issue. |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
212 |
if (FMT_PEDANTIC AND NOT WIN32) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
213 |
add_test(static-export-test ${CMAKE_CTEST_COMMAND} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
214 |
-C ${CMAKE_BUILD_TYPE} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
215 |
--build-and-test |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
216 |
"${CMAKE_CURRENT_SOURCE_DIR}/static-export-test" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
217 |
"${CMAKE_CURRENT_BINARY_DIR}/static-export-test" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
218 |
--build-generator ${CMAKE_GENERATOR} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
219 |
--build-makeprogram ${CMAKE_MAKE_PROGRAM} |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
220 |
--build-options |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
221 |
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
222 |
"-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
223 |
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
224 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
225 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
226 |
# Activate optional CUDA tests if CUDA is found. For version selection see |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
227 |
# https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#cpp14-language-features |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
228 |
if (FMT_CUDA_TEST) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
229 |
if (${CMAKE_VERSION} VERSION_LESS 3.15) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
230 |
find_package(CUDA 9.0) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
231 |
else () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
232 |
include(CheckLanguage) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
233 |
check_language(CUDA) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
234 |
if (CMAKE_CUDA_COMPILER) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
235 |
enable_language(CUDA OPTIONAL) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
236 |
set(CUDA_FOUND TRUE) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
237 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
238 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
239 |
|
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
240 |
if (CUDA_FOUND) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
241 |
add_subdirectory(cuda-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
242 |
add_test(NAME cuda-test COMMAND fmt-in-cuda-test) |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
243 |
endif () |
| a0630906 |
Poul Sander |
2022-01-15 13:59 |
244 |
endif () |
|
|
1970-01-01 00:00 |
245 |
|