Skip to content

Commit

Permalink
CMakeLists.txt: backported GTK_SEMANTIC_VERSION and GLIB_SEMANTIC_VER…
Browse files Browse the repository at this point in the history
…SION from gtk4 branch
  • Loading branch information
vmagnin committed May 8, 2024
1 parent 55bf45a commit 3a21384
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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).
Expand Down
12 changes: 10 additions & 2 deletions CMakeLists.txt
Expand Up @@ -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:
Expand All @@ -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})
Expand All @@ -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:
#===============================================================================
Expand Down

0 comments on commit 3a21384

Please sign in to comment.