diff --git a/CMakeLists.txt b/CMakeLists.txt index bf6718d..3171c1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.30) -set(CMAKE_CXX_COMPILER "/usr/bin/clang++") project(willow-test LANGUAGES CXX) +set(CMAKE_CXX_COMPILER "/usr/bin/clang++") set(CMAKE_CXX_STANDARD 23) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -12,5 +12,7 @@ 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/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; } 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}/..)