mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-11-27 05:16:18 +08:00
use target_compile_definitions for REFLECTCPP_USE_STD_EXPECTED instead of CMAKE_CXX_FLAGS (#507)
This commit is contained in:
+4
-1
@@ -26,7 +26,6 @@ option(REFLECTCPP_USE_BUNDLED_DEPENDENCIES "Use the bundled dependencies" ON)
|
||||
option(REFLECTCPP_USE_STD_EXPECTED "Use std::expected instead of the built-in Result type (requires C++-23)" OFF)
|
||||
|
||||
if(REFLECTCPP_USE_STD_EXPECTED)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DREFLECTCPP_USE_STD_EXPECTED")
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
endif()
|
||||
@@ -160,6 +159,10 @@ else()
|
||||
target_compile_options(reflectcpp PRIVATE $<$<CONFIG:Debug>:-Wall -Wextra>)
|
||||
endif()
|
||||
|
||||
if(REFLECTCPP_USE_STD_EXPECTED)
|
||||
target_compile_definitions(reflectcpp PUBLIC REFLECTCPP_USE_STD_EXPECTED)
|
||||
endif()
|
||||
|
||||
set(REFLECT_CPP_SOURCES
|
||||
src/reflectcpp.cpp
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user