mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 18:19:07 +08:00
98 lines
2.8 KiB
Diff
98 lines
2.8 KiB
Diff
From 0d3c307cee6e8135c84f3f7755bbc10dfd26e02b Mon Sep 17 00:00:00 2001
|
|
From: evpobr <evpobr@gmail.com>
|
|
Date: Sat, 16 Feb 2019 11:50:16 +0500
|
|
Subject: [PATCH] Install CMake package config module
|
|
|
|
---
|
|
CMakeLists.txt | 40 ++++++++++++++++++++++++++++++++++------
|
|
1 file changed, 34 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 5ab14a2..9f5ee5a 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -1,9 +1,10 @@
|
|
-cmake_minimum_required(VERSION 2.8.7)
|
|
+cmake_minimum_required(VERSION 2.8.12)
|
|
project(libogg)
|
|
|
|
# Required modules
|
|
include(GNUInstallDirs)
|
|
include(CheckIncludeFiles)
|
|
+include(CMakePackageConfigHelpers)
|
|
|
|
# Build options
|
|
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
|
@@ -80,18 +81,24 @@ if(BUILD_FRAMEWORK)
|
|
set(BUILD_SHARED_LIBS TRUE)
|
|
endif()
|
|
|
|
-include_directories(include ${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
-add_library(ogg ${OGG_HEADERS} ${OGG_SOURCES})
|
|
+add_library(Ogg ${OGG_HEADERS} ${OGG_SOURCES})
|
|
+
|
|
+target_include_directories(Ogg
|
|
+ PUBLIC
|
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
+)
|
|
|
|
get_version_info(OGG_VERSION_INFO "LIB_CURRENT" "LIB_AGE" "LIB_REVISION")
|
|
set_target_properties(
|
|
- ogg PROPERTIES
|
|
+ Ogg PROPERTIES
|
|
SOVERSION ${OGG_VERSION_INFO}
|
|
PUBLIC_HEADER "${OGG_HEADERS}"
|
|
)
|
|
|
|
if(BUILD_FRAMEWORK)
|
|
- set_target_properties(ogg PROPERTIES
|
|
+ set_target_properties(Ogg PROPERTIES
|
|
FRAMEWORK TRUE
|
|
FRAMEWORK_VERSION ${PROJECT_VERSION}
|
|
MACOSX_FRAMEWORK_IDENTIFIER org.xiph.ogg
|
|
@@ -100,17 +107,38 @@ if(BUILD_FRAMEWORK)
|
|
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
|
|
OUTPUT_NAME Ogg
|
|
)
|
|
+else()
|
|
+ set_target_properties(Ogg PROPERTIES OUTPUT_NAME ogg)
|
|
endif()
|
|
|
|
configure_pkg_config_file(ogg.pc.in)
|
|
|
|
-install(TARGETS ogg
|
|
+set(CMAKE_INSTALL_PACKAGEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Ogg)
|
|
+
|
|
+install(TARGETS Ogg
|
|
+ EXPORT OggConfig
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ogg
|
|
)
|
|
+install(EXPORT OggConfig
|
|
+ NAMESPACE Ogg::
|
|
+ DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}
|
|
+)
|
|
+
|
|
+if(CMAKE_VERSION VERSION_LESS 3.11)
|
|
+ write_basic_package_version_file(OggConfigVersion.cmake COMPATIBILITY SameMajorVersion)
|
|
+else()
|
|
+ write_basic_package_version_file(OggConfigVersion.cmake COMPATIBILITY SameMinorVersion)
|
|
+endif()
|
|
+
|
|
+install(
|
|
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/OggConfigVersion.cmake
|
|
+ DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}
|
|
+)
|
|
+
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ogg.pc
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
)
|
|
--
|
|
2.20.1.windows.1
|
|
|