<div dir="ltr"><div>Hello all,</div><div><p>One of the common patterns in CMake 3.x is the "superbuild" pattern, 
where the source trees of a dependencies are nested under a master 
project. In order for the projects to be modular (be agnostic to whether
 or not the dependencies are nested or not), the in-tree build process 
needs to generate the same targets as finding the dependencies out of 
tree. For example:</p>
<pre><code>cmake_minimum_required(VERSION 3.14)
project(opus-example VERSION 0.0.1 LANGUAGES CXX)

option(USE_SYSTEM_OPUS "Use the system opus" OFF)

if (USE_SYSTEM_OPUS)
    find_package(Opus REQUIRED)
else ()
    add_subdirectory(${PROJECT_SOURCE_DIR}/dependencies/opus)
endif()

add_executable(example ${PROJECT_SOURCE_DIR}/src/example.cpp)
target_link_libraries(example PRIVATE Opus::opus)
</code></pre>
<p>Using find_package to find Opus will create the Opus::opus target, 
but adding the source code directly only adds opus. Aliasing opus to 
Opus::opus lets you keep the target_link_libraries line the same 
regardless of the source of the dependency.</p></div><div>Pull request: <a href="https://github.com/xiph/opus/pull/134">https://github.com/xiph/opus/pull/134</a></div><div><br></div><div>- Nathan<br></div></div>