Add more CMake options

* BUILD_PROGRAMS
** INSTALL_MANPAGES
* INSTALL_PKGCONFIG_MODULES
* INSTALL_CMAKE_CONFIG_MODULE
This commit is contained in:
evpobr 2019-05-29 16:17:53 +05:00 committed by Erik de Castro Lopo
parent 1d5299d67b
commit acadefddac
4 changed files with 48 additions and 35 deletions

View File

@ -13,9 +13,13 @@ project(FLAC VERSION 1.3.3) # HOMEPAGE_URL "https://www.xiph.org/flac/")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(BUILD_CXXLIBS "Build libFLAC++" ON)
option(BUILD_PROGRAMS "Build and install programs" ON)
option(BUILD_EXAMPLES "Build and install examples" ON)
option(BUILD_DOCS "Build and install doxygen documents" ON)
option(WITH_STACK_PROTECTOR "Enable GNU GCC stack smash protection" ON)
option(INSTALL_MANPAGES "Install MAN pages" ON)
option(INSTALL_PKGCONFIG_MODULES "Install PkgConfig modules" ON)
option(INSTALL_CMAKE_CONFIG_MODULE "Install CMake package-config module" ON)
option(WITH_OGG "ogg support (default: test for libogg)" ON)
if(WITH_OGG)
@ -120,6 +124,7 @@ endif()
configure_file(config.cmake.h.in config.h)
if(INSTALL_CMAKE_CONFIG_MODULE)
install(
EXPORT targets
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake"
@ -137,9 +142,12 @@ install(
"${CMAKE_CURRENT_BINARY_DIR}/flac-config-version.cmake"
"cmake/FindOGG.cmake"
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake")
endif()
file(GLOB FLAC_HEADERS "include/FLAC/*.h")
file(GLOB FLAC++_HEADERS "include/FLAC++/*.h")
install(FILES ${FLAC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC")
install(FILES ${FLAC++_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC++")
if(INSTALL_MANPAGES)
install(FILES "man/flac.1" "man/metaflac.1" DESTINATION "${CMAKE_INSTALL_MANDIR}")
endif()

View File

@ -8,8 +8,10 @@ if(BUILD_CXXLIBS)
add_subdirectory("libFLAC++")
endif()
add_subdirectory("share")
if(BUILD_PROGRAMS)
add_subdirectory("flac")
add_subdirectory("metaflac")
endif()
add_subdirectory("utils")
if(WITH_XMMS)

View File

@ -1,9 +1,3 @@
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
configure_file(flac++.pc.in flac++.pc @ONLY)
check_cxx_source_compiles("
#ifdef __STDC_NO_VLA__
syntax error;
@ -45,5 +39,13 @@ install(TARGETS FLAC++ EXPORT targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/")
if(INSTALL_PKGCONFIG_MODULES)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
configure_file(flac++.pc.in flac++.pc @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/flac++.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig")
endif()

View File

@ -45,13 +45,6 @@ if(IA32)
endif()
endif()
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
configure_file(flac.pc.in flac.pc @ONLY)
include_directories("include")
add_library(FLAC
@ -120,5 +113,13 @@ install(TARGETS FLAC EXPORT targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/")
if(INSTALL_PKGCONFIG_MODULES)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
configure_file(flac.pc.in flac.pc @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/flac.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig")
endif()