Skip to content

Commit

Permalink
Export CMake targets to the build tree
Browse files Browse the repository at this point in the history
Properly export Ogg target when added via `add_subdirectory()`.
  • Loading branch information
evpobr committed Oct 26, 2020
1 parent 684c737 commit 36f969b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ if(BUILD_FRAMEWORK)
endif()

add_library(ogg ${OGG_HEADERS} ${OGG_SOURCES})
add_library(Ogg::ogg ALIAS ogg)
target_include_directories(ogg PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
Expand Down Expand Up @@ -127,6 +128,8 @@ install(TARGETS ogg
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ogg
)

export(EXPORT OggTargets NAMESPACE Ogg:: FILE OggTargets.cmake)

if(INSTALL_CMAKE_PACKAGE_MODULE)
set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Ogg)
install(EXPORT OggTargets
Expand Down

0 comments on commit 36f969b

Please sign in to comment.