VirtualBox

source: vbox/trunk/src/libs/libvorbis-1.3.7/CMakeLists.txt@ 96693

Last change on this file since 96693 was 96468, checked in by vboxsync, 2 years ago

libs/libvorbis-1.3.7: Re-exporting, hopefully this time everything is there. bugref:10275

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1cmake_minimum_required(VERSION 2.8.12)
2project(vorbis)
3
4list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
5
6# Required modules
7include(GNUInstallDirs)
8include(CheckIncludeFiles)
9include(CheckLibraryExists)
10
11# Build options
12option(BUILD_SHARED_LIBS "Build shared library" OFF)
13if(APPLE)
14 option(BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF)
15endif()
16
17if(BUILD_FRAMEWORK)
18 set(BUILD_SHARED_LIBS TRUE)
19endif()
20
21option(INSTALL_CMAKE_PACKAGE_MODULE "Install CMake package configiguration module" ON)
22
23# Extract project version from configure.ac
24file(READ configure.ac CONFIGURE_AC_CONTENTS)
25string(REGEX MATCH "AC_INIT\\(\\[libvorbis\\],\\[([0-9]*).([0-9]*).([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
26set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
27set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_2})
28set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_3})
29set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
30
31# Helper function to get version-info
32function(get_version_info result current_var_name age_var_name revision_var_name)
33 string(REGEX MATCH "${current_var_name}=([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
34 set(VERSION_INFO_CURRENT ${CMAKE_MATCH_1})
35
36 string(REGEX MATCH "${age_var_name}=([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
37 set(VERSION_INFO_AGE ${CMAKE_MATCH_1})
38
39 string(REGEX MATCH "${revision_var_name}=([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
40 set(VERSION_INFO_REVISION ${CMAKE_MATCH_1})
41
42 math(EXPR VERSION_INFO_CURRENT_MINUS_AGE "${VERSION_INFO_CURRENT} - ${VERSION_INFO_AGE}")
43
44 set(${result} "${VERSION_INFO_CURRENT_MINUS_AGE}.${VERSION_INFO_AGE}.${VERSION_INFO_REVISION}" PARENT_SCOPE)
45endfunction()
46
47# Helper function to configure pkg-config files
48function(configure_pkg_config_file pkg_config_file_in)
49 set(prefix ${CMAKE_INSTALL_PREFIX})
50 set(exec_prefix ${CMAKE_INSTALL_FULL_BINDIR})
51 set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
52 set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
53 set(VERSION ${PROJECT_VERSION})
54 string(REPLACE ".in" "" pkg_config_file ${pkg_config_file_in})
55 configure_file(${pkg_config_file_in} ${pkg_config_file} @ONLY)
56endfunction()
57
58message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
59
60# Find math library
61
62check_library_exists(m floor "" HAVE_LIBM)
63
64# Find ogg dependency
65find_package(Ogg REQUIRED)
66
67add_subdirectory(lib)
68
69configure_pkg_config_file(vorbis.pc.in)
70configure_pkg_config_file(vorbisenc.pc.in)
71configure_pkg_config_file(vorbisfile.pc.in)
72
73install(
74 FILES
75 ${CMAKE_CURRENT_BINARY_DIR}/vorbis.pc
76 ${CMAKE_CURRENT_BINARY_DIR}/vorbisenc.pc
77 ${CMAKE_CURRENT_BINARY_DIR}/vorbisfile.pc
78 DESTINATION
79 ${CMAKE_INSTALL_LIBDIR}/pkgconfig
80)
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette