[M1] add util::Error, Result<T>, format()

This commit is contained in:
2026-05-08 00:00:21 +00:00
parent 6e922b7249
commit fba725e192
8 changed files with 183 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ project(cargoxx LANGUAGES CXX VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_CXX_SCAN_FOR_MODULES ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -29,9 +29,11 @@ if(CARGOXX_WERROR)
add_compile_options(-Werror)
endif()
# ----- cargoxx library: all module units -----
# ----- cargoxx library: module units + implementation units -----
add_library(cargoxx STATIC)
target_sources(cargoxx
PRIVATE
src/util/error.cpp
PUBLIC
FILE_SET CXX_MODULES FILES
src/lib.cppm
@@ -50,3 +52,10 @@ target_sources(cargoxx
add_executable(cargoxx_bin src/main.cpp)
set_target_properties(cargoxx_bin PROPERTIES OUTPUT_NAME cargoxx)
target_link_libraries(cargoxx_bin PRIVATE cargoxx)
# ----- tests -----
option(CARGOXX_BUILD_TESTS "Build cargoxx tests" ON)
if(CARGOXX_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()