6981f55f28
canon sync rewrites the managed block of CMakeLists.txt from .canon.toml, for after either was edited by hand. It prints a unified diff of the change (also with --dry-run), writes only CMakeLists.txt so comments in .canon.toml survive, does nothing if the block already matches, and warns when the build will still fail because .canon.toml declares files that do not exist. doctor's hand-edited-block warning now points to it. - diff: a small line-based unified diff, no external tools - tests: a sync scenario (hand-edited manifest, --dry-run leaves the file untouched, sync from a subdirectory, no-op second run, hand edits in the block replaced); unit tests for plan_sync and unified_diff Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
37 lines
1.0 KiB
CMake
37 lines
1.0 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(libhello VERSION 0.1.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
option(BUILD_TESTING "Build libhello's tests" ON)
|
|
if(BUILD_TESTING)
|
|
enable_testing()
|
|
endif()
|
|
|
|
# Add your own CMake outside the managed block below.
|
|
|
|
# >>> canon:managed >>>
|
|
# Rendered from .canon.toml; canon rewrites everything between these markers.
|
|
|
|
add_library(libhello
|
|
hello/hello.cpp
|
|
hello/extra.cpp
|
|
)
|
|
set_target_properties(libhello PROPERTIES PREFIX "")
|
|
target_include_directories(libhello PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
target_compile_features(libhello PUBLIC cxx_std_23)
|
|
|
|
if(BUILD_TESTING)
|
|
add_executable(hello.hello.test hello/hello.test.cpp)
|
|
target_link_libraries(hello.hello.test PRIVATE libhello)
|
|
add_test(NAME hello/hello.test COMMAND hello.hello.test)
|
|
|
|
add_executable(tests.basics tests/basics/driver.cpp)
|
|
target_link_libraries(tests.basics PRIVATE libhello)
|
|
add_test(NAME basics COMMAND tests.basics)
|
|
endif()
|
|
|
|
# <<< canon:managed <<<
|