yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
4afd6917
main
1# Copyright (C) 2020 Google, Inc. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# parse_version() reads and parses the version string from FILE, assigning the 16# version string to ${PROJECT}_VERSION and the parsed version to 17# ${PROJECT}_VERSION_MAJOR, ${PROJECT}_VERSION_MINOR, ${PROJECT}_VERSION_PATCH, 18# and the optional ${PROJECT}_VERSION_FLAVOR. 19# 20# The version string take one of the forms: 21# <major>.<minor>.<patch> 22# <major>.<minor>.<patch>-<flavor> 23function ( parse_version FILE PROJECT ) 24configure_file ( $ { FILE } " ${ CMAKE_CURRENT_BINARY_DIR } /CHANGES.md" ) # Required to re-run cmake on version change 25file ( READ ${ FILE } CHANGES ) 26if (${ CHANGES } MATCHES "#+ *([0-9]+)\\.([0-9]+)\\.([0-9]+)(-[a-zA-Z0-9]+)?" ) 27set ( FLAVOR "" ) 28if ( NOT " ${ CMAKE_MATCH_4 } " STREQUAL "" ) 29string ( SUBSTRING ${ CMAKE_MATCH_4 } 1 -1 FLAVOR ) 30endif () 31set ( " ${ PROJECT } _VERSION_MAJOR" ${ CMAKE_MATCH_1 } PARENT_SCOPE ) 32set ( " ${ PROJECT } _VERSION_MINOR" ${ CMAKE_MATCH_2 } PARENT_SCOPE ) 33set ( " ${ PROJECT } _VERSION_PATCH" ${ CMAKE_MATCH_3 } PARENT_SCOPE ) 34set ( " ${ PROJECT } _VERSION_FLAVOR" ${ FLAVOR } PARENT_SCOPE ) 35set ( " ${ PROJECT } _VERSION" 36" ${ CMAKE_MATCH_1 } . ${ CMAKE_MATCH_2 } . ${ CMAKE_MATCH_3 }${ CMAKE_MATCH_4 } " 37PARENT_SCOPE ) 38else () 39message ( FATAL_ERROR "Unable to parse version from ' ${ FILE } '" ) 40endif () 41endfunction ()