fix: [build]Fix build issue without format support
add C++20 <format> support checks in Unix libraries and update logging format usage. Log: Fix build issue without format support.
This commit is contained in:
committed by
Chris Rizzitello
parent
2016ce887b
commit
8226c4162b
@ -89,6 +89,7 @@ macro(configure_unix_libs)
|
||||
include(CheckIncludeFileCXX)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
|
||||
if (NOT HAVE_SYS_SOCKET_H)
|
||||
@ -136,6 +137,23 @@ macro(configure_unix_libs)
|
||||
message(FATAL_ERROR "Missing library: pthread")
|
||||
endif()
|
||||
|
||||
# Check if <format> header is available
|
||||
check_cxx_source_compiles("
|
||||
#include <format>
|
||||
int main() {
|
||||
char buffer[100];
|
||||
std::format_to_n(buffer, 100, \"test {}\", 42);
|
||||
return 0;
|
||||
}
|
||||
" HAS_FORMAT)
|
||||
|
||||
# Display format support status
|
||||
if(HAS_FORMAT)
|
||||
message(STATUS "C++ <format> library support: YES")
|
||||
else()
|
||||
message(STATUS "C++ <format> library support: NO")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
|
||||
find_library(lib_ScreenSaver ScreenSaver)
|
||||
|
||||
Reference in New Issue
Block a user