aboutsummaryrefslogtreecommitdiffhomepage
path: root/externals/fmt/test/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'externals/fmt/test/CMakeLists.txt')
-rw-r--r--externals/fmt/test/CMakeLists.txt23
1 files changed, 17 insertions, 6 deletions
diff --git a/externals/fmt/test/CMakeLists.txt b/externals/fmt/test/CMakeLists.txt
index 5ac19629..6f614d13 100644
--- a/externals/fmt/test/CMakeLists.txt
+++ b/externals/fmt/test/CMakeLists.txt
@@ -1,5 +1,7 @@
add_subdirectory(gtest)
+include(CheckSymbolExists)
+
set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc)
add_library(test-main STATIC ${TEST_MAIN_SRC})
target_include_directories(test-main PUBLIC
@@ -8,9 +10,6 @@ target_link_libraries(test-main gtest fmt)
function(add_fmt_executable name)
add_executable(${name} ${ARGN})
- if (MINGW)
- target_link_libraries(${name} -static-libgcc -static-libstdc++)
- endif ()
# (Wstringop-overflow) - [meta-bug] bogus/missing -Wstringop-overflow warnings
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
# Bogus -Wstringop-overflow warning
@@ -19,6 +18,8 @@ function(add_fmt_executable name)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95353
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
+ target_compile_options(${name} PRIVATE -Wno-stringop-overflow)
+ # The linker flag is needed for LTO.
target_link_libraries(${name} -Wno-stringop-overflow)
endif ()
endfunction()
@@ -36,7 +37,7 @@ function(add_fmt_test name)
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wno-weak-vtables)
endif ()
elseif (ADD_FMT_TEST_MODULE)
- set(libs gtest test-module)
+ set(libs test-main test-module)
set_source_files_properties(${name}.cc PROPERTIES OBJECT_DEPENDS test-module)
else ()
set(libs test-main fmt)
@@ -54,6 +55,10 @@ function(add_fmt_test name)
add_test(NAME ${name} COMMAND ${name})
endfunction()
+if (FMT_MODULE)
+ return ()
+endif ()
+
add_fmt_test(args-test)
add_fmt_test(assert-test)
add_fmt_test(chrono-test)
@@ -76,7 +81,13 @@ if (MSVC)
endif()
add_fmt_test(printf-test)
add_fmt_test(ranges-test ranges-odr-test.cc)
+
add_fmt_test(scan-test)
+check_symbol_exists(strptime "time.h" HAVE_STRPTIME)
+if (HAVE_STRPTIME)
+ target_compile_definitions(scan-test PRIVATE FMT_HAVE_STRPTIME)
+endif ()
+
add_fmt_test(std-test)
try_compile(compile_result_unused
${CMAKE_CURRENT_BINARY_DIR}
@@ -95,13 +106,13 @@ add_fmt_test(enforce-checks-test)
target_compile_definitions(enforce-checks-test PRIVATE
-DFMT_ENFORCE_COMPILE_STRING)
-if (FMT_CAN_MODULE)
+if (FMT_MODULE)
# The tests need {fmt} to be compiled as traditional library
# because of visibility of implementation details.
# If module support is present the module tests require a
# test-only module to be built from {fmt}
add_library(test-module OBJECT ${CMAKE_SOURCE_DIR}/src/fmt.cc)
- target_compile_features(test-module PUBLIC ${FMT_REQUIRED_FEATURES})
+ target_compile_features(test-module PUBLIC cxx_std_11)
target_include_directories(test-module PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
enable_module(test-module)