1 parent
f0825fbd1a
commit
42268c6c35
45 files changed
+2732
-262
No files matched your search
+47
-3
@@ -20,7 +20,7 @@ function(void_add_module MODULE_NAME)
|
||||
set(LIB_TYPE "INTERFACE")
|
||||
set(SCOPE "INTERFACE")
|
||||
add_library(${TGT} INTERFACE)
|
||||
target_compile_features(${TGT} INTERFACE cxx_std_23)
|
||||
target_compile_features(${TGT} INTERFACE cxx_std_26)
|
||||
else()
|
||||
set(LIB_TYPE "SHARED")
|
||||
set(SCOPE "PUBLIC")
|
||||
@@ -30,7 +30,7 @@ function(void_add_module MODULE_NAME)
|
||||
add_library(${TGT} SHARED)
|
||||
endif()
|
||||
target_sources(${TGT} PRIVATE ${SRC})
|
||||
target_compile_features(${TGT} PUBLIC cxx_std_23)
|
||||
target_compile_features(${TGT} PUBLIC cxx_std_26)
|
||||
endif()
|
||||
add_library(${ALIAS} ALIAS ${TGT})
|
||||
|
||||
@@ -73,14 +73,58 @@ function(void_add_module MODULE_NAME)
|
||||
foreach(_opt IN LISTS ARG_OPTIONS_UNIX)
|
||||
target_compile_options(${TGT} PRIVATE "$<$<NOT:$<PLATFORM_ID:Windows>>:${_opt}>")
|
||||
endforeach()
|
||||
|
||||
if(VOID_WARNINGS_AS_ERRORS)
|
||||
target_compile_options(${TGT} PRIVATE
|
||||
"$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall;-Wextra;-Wpedantic;-Werror;-Wno-missing-field-initializers>"
|
||||
"$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-missing-designated-field-initializers>"
|
||||
"$<$<CXX_COMPILER_ID:MSVC>:/W4;/WX>"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(VOID_ENABLE_ASAN)
|
||||
target_compile_options(${TGT} PUBLIC
|
||||
"$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-fsanitize=address;-fno-omit-frame-pointer>"
|
||||
)
|
||||
target_link_options(${TGT} PUBLIC
|
||||
"$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-fsanitize=address>"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(VOID_ENABLE_UBSAN)
|
||||
target_compile_options(${TGT} PUBLIC
|
||||
"$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-fsanitize=undefined>"
|
||||
)
|
||||
target_link_options(${TGT} PUBLIC
|
||||
"$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-fsanitize=undefined>"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(VOID_ENABLE_COVERAGE)
|
||||
target_compile_options(${TGT} PUBLIC
|
||||
"$<$<CXX_COMPILER_ID:GNU>:--coverage;-fprofile-update=atomic>"
|
||||
"$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fprofile-instr-generate;-fcoverage-mapping>"
|
||||
)
|
||||
target_link_options(${TGT} PUBLIC
|
||||
"$<$<CXX_COMPILER_ID:GNU>:--coverage>"
|
||||
"$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fprofile-instr-generate>"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(${TGT} PROPERTIES
|
||||
CXX_STANDARD 23
|
||||
CXX_STANDARD 26
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
EXPORT_NAME ${MODULE_NAME}
|
||||
)
|
||||
|
||||
# GCC 16+ exposes experimental C++26 reflection (P2996) via -freflection.
|
||||
# Apply it to every module unconditionally so any module is free to use
|
||||
# ^^T / std::meta::* without per-module wiring.
|
||||
if(SRC AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
|
||||
target_compile_options(${TGT} PUBLIC -freflection)
|
||||
endif()
|
||||
target_sources(${TGT} ${SCOPE} FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include" FILES ${HDR})
|
||||
target_include_directories(${TGT} ${SCOPE}
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
|
||||
Reference in new issue
Block a user