Export libobs cmake target, so external plugins can be built without ugly hacks

This commit is contained in:
BtbN
2014-05-05 18:57:30 +02:00
parent cfc3f2590e
commit 38594fff9e
6 changed files with 90 additions and 14 deletions

View File

@@ -59,11 +59,11 @@ if(MSVC)
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
"${CMAKE_BINARY_DIR}/config/config.h")
"${CMAKE_CURRENT_SOURCE_DIR}/obsconfig.h.in"
"${CMAKE_BINARY_DIR}/config/obsconfig.h")
set(libobs_config_HEADERS
config.h
"${CMAKE_BINARY_DIR}/config/obsconfig.h"
obs-config.h)
set(libobs_callback_SOURCES
@@ -203,6 +203,7 @@ set(libobs_SOURCES
${libobs_libobs_SOURCES})
set(libobs_HEADERS
${libobs_config_HEADERS}
${libobs_callback_HEADERS}
${libobs_graphics_HEADERS}
${libobs_mediaio_HEADERS}
@@ -225,13 +226,16 @@ set_target_properties(libobs PROPERTIES
OUTPUT_NAME obs
VERSION "0"
SOVERSION "0")
target_compile_definitions(libobs PUBLIC HAVE_OBSCONFIG_H)
target_link_libraries(libobs
jansson
${libobs_PLATFORM_DEPS}
${Libswscale_LIBRARIES}
${Libswresample_LIBRARIES}
${Libavutil_LIBRARIES})
PRIVATE
jansson
${libobs_PLATFORM_DEPS}
${Libswscale_LIBRARIES}
${Libswresample_LIBRARIES}
${Libavutil_LIBRARIES})
install_obs_core(libobs)
install_obs_core(libobs EXPORT LibObs)
install_obs_data(libobs ../build/data/libobs libobs)
install_obs_headers(${libobs_HEADERS})

View File

@@ -0,0 +1,13 @@
# - Config file for the LibObs package
# It defines the following variables
# LIBOBS_INCLUDE_DIRS
# LIBOBS_LIBRARIES
set(LIBOBS_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
if(NOT TARGET libobs)
include("${CMAKE_CURRENT_LIST_DIR}/LibObsTarget.cmake")
endif()
set(LIBOBS_LIBRARIES libobs)

View File

@@ -0,0 +1,10 @@
set(PACKAGE_VERSION "@OBS_VERSION@")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

View File

@@ -17,8 +17,8 @@
#pragma once
#ifdef HAVE_CONFIG_H
# include "config.h"
#ifdef HAVE_OBSCONFIG_H
# include "obsconfig.h"
#else
#define OBS_VERSION "unknown"