Skip to content

Commit c798054

Browse files
authored
Skip the scan-test if strptime isn't defined (#3184)
cygwin and embedded systems. By default newlib doesn't provide strptime in time.h because it was added in a later X/Open versions. Issue: #3178
1 parent 7df30f9 commit c798054

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/CMakeLists.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
add_subdirectory(gtest)
22

3+
include(CheckSymbolExists)
4+
35
set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc)
46
add_library(test-main STATIC ${TEST_MAIN_SRC})
57
target_include_directories(test-main PUBLIC
@@ -75,7 +77,14 @@ if (MSVC)
7577
endif()
7678
add_fmt_test(printf-test)
7779
add_fmt_test(ranges-test ranges-odr-test.cc)
78-
add_fmt_test(scan-test)
80+
81+
check_symbol_exists(strptime "time.h" HAVE_STRPTIME)
82+
if (HAVE_STRPTIME)
83+
add_fmt_test(scan-test)
84+
else()
85+
message(WARNING "Skipping scan-test due to missing strptime dependency.")
86+
endif ()
87+
7988
add_fmt_test(std-test)
8089
try_compile(compile_result_unused
8190
${CMAKE_CURRENT_BINARY_DIR}

0 commit comments

Comments
 (0)