From 96ec77d14d92c28941e50313a269a5b7e8f4fb43 Mon Sep 17 00:00:00 2001 From: ttibsi Date: Sun, 2 Nov 2025 22:06:10 +0000 Subject: [PATCH 1/3] fix --- CMakeLists.txt | 4 +++- README.md | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf6718d..3984815 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.30) -set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() project(willow-test LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) diff --git a/README.md b/README.md index 62caadb..b0ccb14 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@ what you're doing, feel free to clone the repo and do what you need yourself. ```cmake include(FetchContent) fetchcontent_declare( - rawterm + willow GIT_REPOSITORY https://github.com/ttibsi/willow GIT_TAG v0.0.1 ) -fetchcontent_makeavailable(rawterm) +fetchcontent_makeavailable(willow) ``` # Example @@ -23,8 +23,8 @@ file -- anything in the `src/` directory are the tests for this project, `src/willow` is the source code. ```cpp -#include "willow/reporters.h" -#include "willow/willow.h" +#include +#include auto add(int x, int y) -> int { return x + y; } From e7e2dfa4263cfb592ecae703e5f42760c8a9221f Mon Sep 17 00:00:00 2001 From: Ttibsi Date: Mon, 3 Nov 2025 08:32:08 +0000 Subject: [PATCH 2/3] Fix cmake build --- CMakeLists.txt | 11 ++++++----- src/willow/CMakeLists.txt | 15 ++++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3984815..9d96749 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.30) -if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() project(willow-test LANGUAGES CXX) +set(CMAKE_CXX_COMPILER "/usr/bin/clang++") set(CMAKE_CXX_STANDARD 23) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -14,5 +12,8 @@ add_compile_options(-Wconversion) add_compile_options(-Wimplicit-fallthrough) add_subdirectory(src/willow) -add_executable(willow_test src/main.cpp) -target_link_libraries(willow_test PRIVATE willow) +if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + add_executable(willow_test src/main.cpp) + target_link_libraries(willow_test PRIVATE willow) +endif() + diff --git a/src/willow/CMakeLists.txt b/src/willow/CMakeLists.txt index 868b0c7..8a45bad 100644 --- a/src/willow/CMakeLists.txt +++ b/src/willow/CMakeLists.txt @@ -1,7 +1,12 @@ -add_library(willow STATIC - willow.cpp +add_library(willow STATIC) +set_target_properties(willow PROPERTIES LINKER_LANGUAGE CXX) +target_sources(willow + # PRIVATE + # foo.cpp + PUBLIC + reporters.h + test.h + willow.h ) -target_include_directories(willow PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/.. -) +target_include_directories(willow PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) From dd395c053a1e7b34c3add565d8a60b9ce843e6e6 Mon Sep 17 00:00:00 2001 From: Ttibsi Date: Mon, 3 Nov 2025 10:52:10 +0000 Subject: [PATCH 3/3] formatting --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d96749..3171c1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,8 +12,7 @@ add_compile_options(-Wconversion) add_compile_options(-Wimplicit-fallthrough) add_subdirectory(src/willow) -if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) add_executable(willow_test src/main.cpp) target_link_libraries(willow_test PRIVATE willow) endif() -