forked from pool/cmake
Dirk Mueller
e0903fafcc
- udate to 3.30.0 * "cmake-presets(7)" files now support schema version "9". "include" fields now expand all macros except "$env{}" and preset-specific macros, i.e., those derived from the fields inside a preset's definition. * The "Compile Features" functionality now implements support for the "cxx_std_26" and "cuda_std_26" meta-features to indicate that the compiler mode must be at least C++26. * The "CMAKE_<LANG>_STANDARD_LATEST" variable was added to describe the latest "<LANG>" language standard CMake supports for the selected compiler. * The "CMAKE_TLS_VERSION" variable and "CMAKE_TLS_VERSION" environment variable were added to specify a default minimum TLS version for connections to "https://" URLs by the "file(DOWNLOAD)" and "file(UPLOAD)" commands. * The "GENERATED" source file property is now visible in all directories. See policy "CMP0163". Policy "CMP0118"'s documentation has been revised to describe its actual effects. * The "TARGET_PROPERTY" generator expression learned to evaluate custom transitive properties. * The "CPack WIX Generator" gained support for WiX Toolset v4. See the "CPACK_WIX_VERSION" variable. * The "FindBoost" module has been removed by policy "CMP0167". Port projects to upstream Boost's "BoostConfig.cmake" package configuration file, for which "find_package(Boost)" now searches. - Add cmake-fix-test-without-git.patch to fix test #567 to be run conditionally when Git is found, upstream planned for 3.30.1 OBS-URL: https://build.opensuse.org/request/show/1185206 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=587
87 lines
3.2 KiB
Python
87 lines
3.2 KiB
Python
#!/usr/bin/python3
|
|
# -*- coding:utf-8 -*-
|
|
#
|
|
# Copyright (C) 2015 Daniel Vrátil <dvratil@redhat.com>
|
|
#
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU Library General Public License as
|
|
# published by the Free Software Foundation; either version 2 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Library General Public
|
|
# License along with this program; if not, write to the
|
|
# Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#
|
|
|
|
import sys
|
|
import re
|
|
import glob
|
|
|
|
class CMakeParser:
|
|
def __init__(self, filelist = None):
|
|
if filelist == None:
|
|
filelist = sys.stdin
|
|
|
|
paths = map(lambda x: x.rstrip(), filelist.readlines())
|
|
for path in paths:
|
|
for (modulePath, cmakeModule, lowercase) in self.parseCmakeModuleConfig(path):
|
|
version = self.resolveCMakeModuleVersion(modulePath, cmakeModule, lowercase)
|
|
|
|
if version:
|
|
print("cmake(%s) = %s" % (cmakeModule, version))
|
|
else:
|
|
print("cmake(%s)" % cmakeModule)
|
|
|
|
def parseCmakeModuleConfig(self, configFile):
|
|
paths = configFile.rsplit("/", 3)
|
|
|
|
modulePath = "%s/cmake/%s" % (paths[0], paths[2])
|
|
|
|
result = []
|
|
for configFile in glob.glob("%s/*Config.cmake" % modulePath):
|
|
moduleName = configFile[len(modulePath) + 1:-len("Config.cmake")]
|
|
result.append( (modulePath, moduleName, False) )
|
|
|
|
for configFile in glob.glob("%s/*-config.cmake" % modulePath):
|
|
moduleName = configFile[len(modulePath) + 1:-len("-config.cmake")]
|
|
if (modulePath, moduleName, False) not in result:
|
|
result.append( (modulePath, moduleName, True) )
|
|
|
|
return result
|
|
|
|
def resolveCMakeModuleVersion(self, modulePath, cmakeModule, lowercase):
|
|
# Qt >= 6.2.2 defines 'PACKAGE_VERSION' in *ConfigVersionImpl.cmake
|
|
versionFile = f"{modulePath}/{cmakeModule}ConfigVersionImpl.cmake" if "Qt6" in f"{cmakeModule}" else ""
|
|
try:
|
|
f = open(versionFile, 'r')
|
|
except:
|
|
versionFile = ("%s/%s-config-version.cmake" if lowercase else "%s/%sConfigVersion.cmake") % (modulePath, cmakeModule)
|
|
try:
|
|
f = open(versionFile, 'r')
|
|
except:
|
|
return None
|
|
|
|
for line in f:
|
|
line = line.strip()
|
|
|
|
# set(PACKAGE_VERSION <version>)
|
|
version = re.match(r"^set[\ ]*\([\ ]*PACKAGE_VERSION[\ ]+[\"]*([0-9\.]+)[\"]*[\ ]*[.]*\)", line)
|
|
if version:
|
|
_version = version.groups(1)[0]
|
|
if _version == '..':
|
|
sys.stderr.write("error: Version pattern found without values - '%s' was created incorrectly\n" % versionFile)
|
|
return _version
|
|
|
|
|
|
return None
|
|
|
|
if __name__ == "__main__":
|
|
parser = CMakeParser()
|