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/details/core.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(hello.details.core.test hello/details/core.test.cpp)
  target_link_libraries(hello.details.core.test PRIVATE libhello)
  add_test(NAME hello/details/core.test COMMAND hello.details.core.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 <<<
