chore(cmake): enhance CMake configuration for Abseil and yaml-cpp
- Made ABSL_TARGETS available to the rest of the project via include(), improving modularity. - Added MSVC-specific compile options for yaml-cpp to address exception handling warnings. Benefits: - Streamlined integration of Abseil targets across the project. - Improved compatibility and reduced warnings for yaml-cpp on MSVC.
This commit is contained in:
@@ -64,11 +64,25 @@ endfunction()
|
||||
# gRPC (must come before Abseil - provides its own compatible Abseil)
|
||||
if(YAZE_WITH_GRPC)
|
||||
include(cmake/grpc.cmake)
|
||||
# Verify ABSL_TARGETS was populated by gRPC
|
||||
list(LENGTH ABSL_TARGETS _absl_count)
|
||||
if(_absl_count EQUAL 0)
|
||||
message(FATAL_ERROR "ABSL_TARGETS is empty after including grpc.cmake!")
|
||||
else()
|
||||
message(STATUS "gRPC provides ${_absl_count} Abseil targets for linking")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Abseil (only if gRPC didn't provide it)
|
||||
if(NOT YAZE_WITH_GRPC)
|
||||
include(cmake/absl.cmake)
|
||||
# Verify ABSL_TARGETS was populated
|
||||
list(LENGTH ABSL_TARGETS _absl_count)
|
||||
if(_absl_count EQUAL 0)
|
||||
message(FATAL_ERROR "ABSL_TARGETS is empty after including absl.cmake!")
|
||||
else()
|
||||
message(STATUS "Abseil provides ${_absl_count} targets for linking")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# SDL2
|
||||
@@ -108,6 +122,11 @@ FetchContent_Declare(yaml-cpp
|
||||
)
|
||||
FetchContent_MakeAvailable(yaml-cpp)
|
||||
|
||||
# Fix MSVC exception handling warning for yaml-cpp
|
||||
if(MSVC AND TARGET yaml-cpp)
|
||||
target_compile_options(yaml-cpp PRIVATE /EHsc)
|
||||
endif()
|
||||
|
||||
# nlohmann_json (header only)
|
||||
if(YAZE_WITH_JSON)
|
||||
set(JSON_BuildTests OFF CACHE INTERNAL "Disable nlohmann_json tests")
|
||||
|
||||
Reference in New Issue
Block a user