Skip to content

Commit

Permalink
CMake: workaround for OSS-Fuzz std::format detection
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos authored Jan 14, 2025
1 parent a1b65bb commit e7a3dda
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ endif()

include_directories(${CMAKE_BINARY_DIR}) # Make the exv_conf.h file visible for the full project

# Workaround for OSS-Fuzz (LLVM 18 implements std::format, but has no feature test macro)
if(CMAKE_CXX_STANDARD GREATER_EQUAL 20 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17)
set(HAVE_STD_FORMAT 1 CACHE INTERNAL "Have symbol __cpp_lib_format")
endif()

check_cxx_symbol_exists(__cpp_lib_format "format" HAVE_STD_FORMAT)
if(NOT HAVE_STD_FORMAT)
find_package(fmt REQUIRED)
Expand Down

0 comments on commit e7a3dda

Please sign in to comment.