Skip to content

Commit 3069cc2

Browse files
concatimerillian
authored andcommitted
CMake: Use project version
1 parent dad4c34 commit 3069cc2

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

CMakeLists.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
cmake_minimum_required(VERSION 3.0)
2-
project(ogg LANGUAGES C)
2+
3+
# Extract project version from configure.ac
4+
file(READ configure.ac CONFIGURE_AC_CONTENTS)
5+
string(REGEX MATCH "AC_INIT\\(\\[libogg\\],\\[([0-9]*\\.[0-9]*\\.[0-9]*)\\]" DUMMY ${CONFIGURE_AC_CONTENTS})
6+
7+
project(ogg VERSION ${CMAKE_MATCH_1} LANGUAGES C)
38

49
# Required modules
510
include(GNUInstallDirs)
@@ -18,14 +23,6 @@ option(INSTALL_DOCS "Install documentation" ON)
1823
option(INSTALL_PKG_CONFIG_MODULE "Install ogg.pc file" ON)
1924
option(INSTALL_CMAKE_PACKAGE_MODULE "Install CMake package configuration module" ON)
2025

21-
# Extract project version from configure.ac
22-
file(READ configure.ac CONFIGURE_AC_CONTENTS)
23-
string(REGEX MATCH "AC_INIT\\(\\[libogg\\],\\[([0-9]*).([0-9]*).([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
24-
set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
25-
set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_2})
26-
set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_3})
27-
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
28-
2926
# Extract library version from configure.ac
3027
string(REGEX MATCH "LIB_CURRENT=([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
3128
set(LIB_CURRENT ${CMAKE_MATCH_1})

0 commit comments

Comments
 (0)