Skip to content

Commit d6da0de

Browse files
committed
Check C++20 support and update test-stream executable configuration
1 parent 51aa9c8 commit d6da0de

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ gtest_discover_tests(httplib-test)
3535
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang|MSVC")
3636
# Check for C++20 support
3737
include(CheckCXXCompilerFlag)
38-
check_cxx_compiler_flag("-std=c++20" COMPILER_SUPPORTS_CXX20)
3938
if(MSVC)
40-
set(COMPILER_SUPPORTS_CXX20 TRUE)
39+
check_cxx_compiler_flag("/std:c++20" COMPILER_SUPPORTS_CXX20)
40+
else()
41+
check_cxx_compiler_flag("-std=c++20" COMPILER_SUPPORTS_CXX20)
4142
endif()
4243

44+
message(STATUS "C++20 support: ${COMPILER_SUPPORTS_CXX20}")
45+
4346
if(COMPILER_SUPPORTS_CXX20)
4447
add_executable(httplib-test-stream test-stream.cc)
4548
target_compile_features(httplib-test-stream PRIVATE cxx_std_20)
@@ -48,6 +51,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang|MSVC")
4851
)
4952
target_link_libraries(httplib-test-stream PRIVATE httplib GTest::gtest_main)
5053
gtest_discover_tests(httplib-test-stream)
54+
message(STATUS "Building httplib-test-stream (C++20 streaming tests)")
5155
else()
5256
message(STATUS "C++20 not supported, skipping test-stream")
5357
endif()

0 commit comments

Comments
 (0)