New alias target etl::etl and CMake instructions update (#540)

* correction for link call in CMake instructions

* add alias target etl::etl
This commit is contained in:
Robin Mueller 2022-05-17 18:08:47 +02:00 committed by GitHub
parent f5ebc9e1f3
commit 48b0c52e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>

View File

@ -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 `<majorVersionRequirement>` with your desired major version:
```cmake
find_package(etl <majorVersionRequirement>)
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