mirror of https://github.com/xiph/flac
Export flac properly when use with add_subdirectory (#285)
This allows for flac to be used in a larger CMake project with add_subdirectory. It also allows for Ogg to be build elsewhere in the larger project.
This commit is contained in:
parent
95064f9f08
commit
39e6e570d8
|
@ -42,7 +42,11 @@ if(WITH_OGG)
|
||||||
set_target_properties(test_bitwise test_framing PROPERTIES FOLDER Tests)
|
set_target_properties(test_bitwise test_framing PROPERTIES FOLDER Tests)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
if(NOT TARGET Ogg::ogg)
|
||||||
find_package(Ogg REQUIRED)
|
find_package(Ogg REQUIRED)
|
||||||
|
else()
|
||||||
|
set(OGG_FOUND 1 CACHE INTERNAL "ogg has already been built")
|
||||||
|
endif()
|
||||||
set(OGG_PACKAGE "ogg")
|
set(OGG_PACKAGE "ogg")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -228,12 +232,18 @@ if(INSTALL_CMAKE_CONFIG_MODULE)
|
||||||
EXPORT targets
|
EXPORT targets
|
||||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake"
|
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake"
|
||||||
NAMESPACE FLAC::)
|
NAMESPACE FLAC::)
|
||||||
|
export(EXPORT targets NAMESPACE FLAC:: FILE FLACTargets.cmake)
|
||||||
|
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
flac-config.cmake.in flac-config.cmake
|
${PROJECT_SOURCE_DIR}/flac-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/flac-config.cmake
|
||||||
INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake")
|
INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake")
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
flac-config-version.cmake COMPATIBILITY AnyNewerVersion)
|
${CMAKE_CURRENT_BINARY_DIR}/flac-config-version.cmake COMPATIBILITY AnyNewerVersion)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/flac-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/flac-config-version.cmake
|
||||||
|
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake"
|
||||||
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
find_dependency(Ogg)
|
if(NOT TARGET Ogg::ogg)
|
||||||
|
find_dependency(Ogg)
|
||||||
|
endif()
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue