Commit ec2d16de authored by evpobr's avatar evpobr Committed by Erik de Castro Lopo

Fixes for CMake config-file package generation (#51)

parent 6ccfcc2d
......@@ -115,7 +115,7 @@ endif()
configure_pkg_config_file(ogg.pc.in)
install(TARGETS ogg
EXPORT ogg-targets
EXPORT OggTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......@@ -123,20 +123,26 @@ install(TARGETS ogg
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ogg
)
write_basic_package_version_file(ogg-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
if(INSTALL_CMAKE_PACKAGE_MODULE)
set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ogg)
install(EXPORT ogg-targets
set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Ogg)
install(EXPORT OggTargets
DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
NAMESPACE Ogg::
FILE ogg-config.cmake
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ogg-config-version.cmake
include(CMakePackageConfigHelpers)
configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/OggConfig.cmake.in ${PROJECT_BINARY_DIR}/OggConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
PATH_VARS CMAKE_INSTALL_FULL_INCLUDEDIR
)
write_basic_package_version_file(${PROJECT_BINARY_DIR}/OggConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES ${PROJECT_BINARY_DIR}/OggConfig.cmake ${PROJECT_BINARY_DIR}/OggConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
)
endif()
......
......@@ -16,7 +16,7 @@ pkgconfig_DATA = ogg.pc
EXTRA_DIST = README.md AUTHORS CHANGES COPYING \
libogg.spec libogg.spec.in \
ogg.m4 ogg.pc.in ogg-uninstalled.pc.in \
macosx win32 CMakeLists.txt
macosx win32 CMakeLists.txt cmake/OggConfig.cmake.in
dist-hook:
for item in $(EXTRA_DIST); do \
......
@PACKAGE_INIT@
set(Ogg_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(OGG_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(Ogg_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(OGG_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
include(${CMAKE_CURRENT_LIST_DIR}/OggTargets.cmake)
set(Ogg_LIBRARY Ogg::ogg)
set(OGG_LIBRARY Ogg::ogg)
set(Ogg_LIBRARIES Ogg::ogg)
set(OGG_LIBRARIES Ogg::ogg)
check_required_components(Ogg)
set(OGG_FOUND 1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment