From 3a2138470a7d9f1434162520945a1b9f76514364 Mon Sep 17 00:00:00 2001 From: vmagnin Date: Wed, 8 May 2024 11:00:04 +0200 Subject: [PATCH] CMakeLists.txt: backported GTK_SEMANTIC_VERSION and GLIB_SEMANTIC_VERSION from gtk4 branch --- CHANGELOG.md | 1 + CMakeLists.txt | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d77d0d6a..17714a3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Offers Fortran interfaces to the latests GTK 3.24.41, GLib 2.80.0, Cairo 1.18.0. - `src/gtk-fortran_funptr.csv`: list of all the `funptr` types used in the prototypes of the C functions. Generated by the `cfwrapper/cfwrapper.py` script, which will also print the number of `funptr` in its statistics. - `src/build.sh` (backported from gtk4 branch) is now an interactive script proposing to build, test and install gtk-fortran. It uses the default Fortran compiler, then build and test with Intel ifx. - `cmake/cmake_uninstall.cmake.in`: improved the code layout (backported from gtk4 branch). +- `CMakeLists.txt`: backported GTK_SEMANTIC_VERSION and GLIB_SEMANTIC_VERSION from gtk4 branch. ### Fixed - `src/gtk-fortran.pc.in`: the line `Libs:` was modified to fix a problem with the macOS linker (which is not GNU ld and does not accept the `-R` option). diff --git a/CMakeLists.txt b/CMakeLists.txt index 144a3fa9..b20245ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ #=============================================================================== # Contributed by Kyle Horne: 05.11.2011 # Last modifications: James Tappin 8/17/2012, Jens Hunger 01/07/2018, -# vmagnin 2021-06-07 +# vmagnin 2021-06-07, 2024-05-08 # # CMAKE build file for gtk-fortran # Options: @@ -44,10 +44,11 @@ set(CMAKE_PROJECT_DESCRIPTION "A partial GTK / Fortran binding") set(CMAKE_PROJECT_HOMEPAGE_URL "https://github.com/vmagnin/gtk-fortran/wiki/") #=============================================================================== -# Major version of GTK for the current branch (from VERSIONS file): +# Version of gtk-fortran for the current branch (from VERSIONS file): #=============================================================================== file(STRINGS VERSIONS OneLine REGEX "gtk-fortran;(.*)") string(REGEX REPLACE "gtk-fortran;" "" SEMANTIC_VERSION ${OneLine}) +# Major, minor and patch versions of gtk-fortran: string(REGEX MATCH "[0-9]+" GTKv ${SEMANTIC_VERSION}) string(REGEX REPLACE "[0-9]+\.([0-9]+)\.[0-9]+" "\\1" MINOR_VERSION ${SEMANTIC_VERSION}) string(REGEX REPLACE "[0-9]+\.[0-9]+\.([0-9]+)" "\\1" PATCH_VERSION ${SEMANTIC_VERSION}) @@ -65,6 +66,13 @@ set(CMAKE_PROJECT_VERSION_MAJOR ${GTKv}) set(CMAKE_PROJECT_VERSION_MINOR ${MINOR_VERSION}) set(CMAKE_PROJECT_VERSION_PATCH ${PATCH_VERSION}) +# Extracting the GTK and GLib versions from the VERSIONS file: +file(STRINGS VERSIONS OneLine REGEX "GTK;(.*)") +string(REGEX REPLACE "GTK;" "" GTK_SEMANTIC_VERSION ${OneLine}) +file(STRINGS VERSIONS OneLine REGEX "GLib;(.*)") +string(REGEX REPLACE "GLib;" "" GLIB_SEMANTIC_VERSION ${OneLine}) +message(STATUS "Based on GTK ${GTK_SEMANTIC_VERSION} and GLib ${GLIB_SEMANTIC_VERSION}") + #=============================================================================== # Define GNU standard installation directories: #===============================================================================