From 48b0c52e92b4d032d3c6fa0203745f3527e91784 Mon Sep 17 00:00:00 2001 From: Robin Mueller <31589589+robamu@users.noreply.github.com> Date: Tue, 17 May 2022 18:08:47 +0200 Subject: [PATCH] New alias target etl::etl and CMake instructions update (#540) * correction for link call in CMake instructions * add alias target etl::etl --- CMakeLists.txt | 3 +++ README.md | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cf7a050..164a7dca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,9 @@ option(BUILD_TESTS "Build unit tests" OFF) option(NO_STL "No STL" OFF) add_library(${PROJECT_NAME} INTERFACE) +# This allows users which use the add_subdirectory or FetchContent +# to use the same target as users which use find_package +add_library(etl::etl ALIAS ${PROJECT_NAME}) target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE $ diff --git a/README.md b/README.md index 72601b2c..8f99c16f 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ and then make the library available by using `add_subdirectory` ```cmake add_subdirectory(etl) add_executable(foo main.cpp) -target_link_libraries(foo PRIVATE etl) +target_link_libraries(foo PRIVATE etl::etl) ``` If ETL library is used as a Git submodule it may require additional configuration for proper ETL version resolution by allowing the lookup for Git folder outside of the library root directory. @@ -103,7 +103,7 @@ Replace `` with your desired major version: ```cmake find_package(etl ) add_executable(foo main.cpp) -target_link_libraries(foo PRIVATE etl) +target_link_libraries(foo PRIVATE etl::etl) ``` @@ -122,7 +122,7 @@ FetchContent_Declare( FetchContent_MakeAvailable(etl) add_executable(foo main.cpp) -target_link_libraries(foo PRIVATE etl) +target_link_libraries(foo PRIVATE etl::etl) ``` ## Arduino library