cmake/cmake.prov
Dirk Mueller 8f444423a9 Accepting request 1222559 from home:mathletic:branches:devel:tools:building
- update to 3.31.0
  * cmake-presets(7) files may now include comments using the key
    "$comment" at any level within the JSON object to provide
    documentation.
  * The Ninja Generators and Makefile Generators now produce a
    "codegen" build target.
  * The "CMAKE_LINK_LIBRARIES_STRATEGY" variable and corresponding
    "LINK_LIBRARIES_STRATEGY" target property were added to
    optionally specify the strategy CMake uses to generate link
    lines.
  * The "CMAKE_EXPORT_BUILD_DATABASE" variable, a corresponding
    "CMAKE_EXPORT_BUILD_DATABASE" environment variable, and an
    "EXPORT_BUILD_DATABASE" target property, were added to enable
    exporting C++ module compile commands. This is only supported
    with Ninja Generators.
  * The "CMAKE_<LANG>_HOST_COMPILER_ID" and
    "CMAKE_<LANG>_HOST_COMPILER_VERSION" variables were added,
    where "<LANG>" is either "CUDA" or "HIP".  They are populated
    when "CMAKE_<LANG>_COMPILER_ID" is "NVIDIA" to identify NVCC's
    host compiler.
  * The "file(DOWNLOAD)" and "file(UPLOAD)" commands now verify TLS
    server certificates for connections to "https://" URLs by
    default.

OBS-URL: https://build.opensuse.org/request/show/1222559
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=608
2024-11-12 09:41:39 +00:00

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()