2022-07-04 03:09:56 +02:00
# Copyright (C) 2022, Michael Fabian 'Xaymar' Dirks <info@xaymar.com>. All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2022-07-04 07:47:10 +02:00
#[=======================================================================[.rst:
v e r s i o n
- - - - - - -
G e n e r a t e , p a r s e a n d m o d i f y v e r s i o n s p u r e l y w i t h C M a k e . S u p p o r t s S e m a n t i c V e r s i o n i n g 2 . 0 . 0 , 1 . 0 . 0 a n d o t h e r v e r s i o n f o r m a t s .
S y n o p s i s
^ ^ ^ ^ ^ ^ ^ ^
. . p a r s e d - l i t e r a l : :
version ( `PARSE`_ <out-var> <string> )
version ( `GENERATE`_ <out-var> [COMPRESS] [MAJOR <major>] [MINOR <minor>] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>] )
version ( `MODIFY`_ <out-var> <string> [COMPRESS] [MAJOR <major>] [MINOR <minor] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>] )
version ( `COMPARE`_ <out-var> <a> <b> )
T h e f o l l o w i n g v e r s i o n c o n s t r u c t s a r e c u r r e n t l y s u p p o r t e d :
. . c o d e - b l o c k : :
< m a j o r > " . " < m i n o r > [ " . " < p a t c h > [ " . " < t w e a k > ] ]
< m a j o r > " . " < m i n o r > [ " . " < p a t c h > [ " . " < t w e a k > ] ] [ [ " - " ] < p r e - r e l e a s e > ] [ " + " < b u i l d > ]
P a r s i n g
^ ^ ^ ^ ^ ^ ^
. . _ P A R S E :
. . c o d e - b l o c k : : c m a k e
version ( PARSE <out-var> <string> )
A t t e m p t s t o p a r s e t h e v e r s i o n i n ` ` < s t r i n g > ` ` a n d s t o r e s t h e i n d i v i d u a l c o m p o e n t s i n t o ` ` < o u t - v a r > _ < c o m p o n e n t > ` ` . I f a c o m p o n e n t i s n o t p r e s e n t i n t h e g i v e n v e r s i o n , i t w i l l b e u n d e f i n e d . I f a n e r r o r o c c u r r e d , ` ` < o u t - v a r > _ E R R O R ` ` w i l l b e d e f i n e d a n d c o n t a i n t h e e r r o r m e s s a g e .
G e n e r a t i n g
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
. . _ G E N E R A T E :
. . c o d e - b l o c k : : c m a k e
version ( GENERATE <out-var> [COMPRESS] [MAJOR <major>] [MINOR <minor>] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>] )
G e n e r a t e s a v e r s i o n f r o m t h e c o m p o n e n t s p r o v i d e d a n d s t o r e s t h e r e s u l t i n ` ` < o u t - v a r > ` ` . T h e c o m p o n e n t s ` ` < m a j o r > ` ` a n d ` ` < m i n o r > ` ` w i l l d e f a u l t t o ` ` 0 ` ` i f n o t p r o v i d e d . I f a n e r r o r o c c u r r e d , ` ` < o u t - v a r > _ E R R O R ` ` w i l l b e d e f i n e d a n d c o n t a i n t h e e r r o r m e s s a g e .
M o d i f y i n g
^ ^ ^ ^ ^ ^ ^ ^ ^
. . _ M O D I F Y :
. . c o d e - b l o c k : : c m a k e
version ( MODIFY <out-var> <string> [COMPRESS] [MAJOR <major>] [MINOR <minor] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>] )
M o d i f i e s t h e v e r s i o n p r o v i d e d i n ` ` < s t r i n g > ` ` w i t h t h e c o m p o n e n t s p r o v i d e d . T h e c o m p o n e n t s ` ` < m a j o r > ` ` , ` ` < m i n o r > ` ` , ` ` < p a t c h > ` ` a n d ` ` < t w e a k > ` ` m a y h a v e a p r e f i x o f ` ` + ` ` o r ` ` - ` ` t o a d d a n d s u b t r a c t t h e v a l u e , o r n o p r e f i x t o r e p l a c e . T h e r e s u l t o f t h i s o p e r a t i o n w i l l b e s t o r e d a s a s t r i n g i n ` ` < o u t - v a r > ` ` . I f a c o m p o n e n t d i d n o t e x i s t i n t h e o r i g i n a l , i t w i l l b e a d d e d t o t h e v e r s i o n a s a r e p l a c e o p e r a t i o n . I f a n e r r o r o c c u r r e d , ` ` < o u t - v a r > _ E R R O R ` ` w i l l b e d e f i n e d a n d c o n t a i n t h e e r r o r m e s s a g e .
C o m p a r i n g
^ ^ ^ ^ ^ ^ ^ ^ ^
. . _ C O M P A R E :
. . c o d e - b l o c k : : c m a k e
version ( COMPARE <out-var> <a> <b> )
C o m p a r e s t h e v e r s i o n ` ` < a > ` ` a g a i n s t ` ` < b > ` ` a n d s t o r e s t h e r e s u l t i n ` ` < o u t - v a r > ` ` . T h e p r o v i d e d v e r s i o n w i l l b e e v a l u a t e d i n t h e o r d e r M A J O R , M I N O R , P A T C H , T W E A K , P R E R E L E A S E , a n d t h e n B U I L D . T h e f o l l o w i n g r e s u l t s s h o u l d b e e x p e c t e d :
- I f a c o m p o n e n t i s o n l y i n ` ` < a > ` ` , ` ` < o u t - v a r > ` ` w i l l c o n t a i n t h e c o m p o n e n e n t n a m e p r e f i x e d b y ` ` + ` ` .
- I f a c o m p o n e n t i s o n l y i n ` ` < b > ` ` , ` ` < o u t - v a r > ` ` w i l l c o n t a i n t h e c o m p o n e n e n t n a m e p r e f i x e d b y ` ` - ` ` .
- I f a c o m p o n e n t i s n u m e r i c a l a n d t h e v a l u e i s l a r g e r i n ` ` < a > ` ` , ` ` < o u t - v a r > ` ` w i l l c o n t a i n t h e c o m p o n e n e n t n a m e p r e f i x e d b y ` ` > ` ` .
- I f a c o m p o n e n t i s n u m e r i c a l a n d t h e v a l u e i s l a r g e r i n ` ` < b > ` ` , ` ` < o u t - v a r > ` ` w i l l c o n t a i n t h e c o m p o n e n e n t n a m e p r e f i x e d b y ` ` < ` ` .
- I f a c o m p o n e n t i s a l p h a n u m e r i c a l a n d t h e v a l u e i s d i f f e r e n t i n e i t h e r , ` ` < o u t - v a r > ` ` w i l l c o n t a i n t h e c o m p o n e n t n a m e w i t h n o p r e f i x .
- I n a l l o t h e r c a s e s , ` ` < o u t - v a r > ` ` w i l l b e e m p t y .
- I f a n e r r o r o c c u r r e d , ` ` < o u t - v a r > _ E R R O R ` ` w i l l b e d e f i n e d a n d c o n t a i n t h e e r r o r m e s s a g e , a n d ` ` < o u t - v a r > ` ` w i l l b e u n d e f i n e d .
#]=======================================================================]
2022-07-04 03:09:56 +02:00
function ( version )
unset ( ${ OUT_VAR } PARENT_SCOPE )
unset ( ${ OUT_VAR } _ERROR PARENT_SCOPE )
set ( OUT_VAR "${ARGV1}" )
set ( _ "" )
string ( TOUPPER "${ARGV0}" ARGV0 )
if ( ARGV0 STREQUAL "PARSE" )
# <major> "." <minor> ["." <patch> ["." <tweak>]]
# <major> "." <minor> ["." <patch> ["." <tweak>]] [["-"] <pre-release>] ["+" <build>]
# One regex to rule them all...
if ( NOT ( ARGV2 MATCHES [[^([0-9]+ ) \.([0-9]+)(\.[0-9]+|)(\.[0-9]+|)(-?[a-zA-Z0-9]+[a-zA-Z0-9\.\-]*|)(\+[a-zA-Z0-9]+[a-zA-Z0-9\.\-]*|)$]]))
set( ${ OUT_VAR } _ERROR "Version format not supported: '${ARGV2}'" PARENT_SCOPE )
return ( )
endif ( )
# {1} = Major
set ( ${ OUT_VAR } _MAJOR "${CMAKE_MATCH_1}" PARENT_SCOPE )
# {2} = Minor
set ( ${ OUT_VAR } _MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE )
# {3} = Patch
if ( CMAKE_MATCH_3 )
string ( SUBSTRING "${CMAKE_MATCH_3}" 1 -1 _TMP )
set ( ${ OUT_VAR } _PATCH "${_TMP}" PARENT_SCOPE )
else ( )
unset ( ${ OUT_VAR } _PATCH PARENT_SCOPE )
endif ( )
# {4} = Tweak
if ( CMAKE_MATCH_4 )
string ( SUBSTRING "${CMAKE_MATCH_4}" 1 -1 _TMP )
set ( ${ OUT_VAR } _TWEAK "${_TMP}" PARENT_SCOPE )
else ( )
unset ( ${ OUT_VAR } _TWEAK PARENT_SCOPE )
endif ( )
# {5} = PreRelease
if ( CMAKE_MATCH_5 )
string ( SUBSTRING "${CMAKE_MATCH_5}" 0 1 _TMP )
if ( _TMP STREQUAL "-" )
string ( SUBSTRING "${CMAKE_MATCH_5}" 1 -1 _TMP )
set ( ${ OUT_VAR } _PRERELEASE "${_TMP}" PARENT_SCOPE )
else ( )
set ( ${ OUT_VAR } _PRERELEASE "${CMAKE_MATCH_5}" PARENT_SCOPE )
endif ( )
else ( )
unset ( ${ OUT_VAR } _PRERELEASE PARENT_SCOPE )
endif ( )
# {6} = Build
if ( CMAKE_MATCH_6 )
string ( SUBSTRING "${CMAKE_MATCH_6}" 1 -1 _TMP )
set ( ${ OUT_VAR } _BUILD "${_TMP}" PARENT_SCOPE )
else ( )
unset ( ${ OUT_VAR } _BUILD PARENT_SCOPE )
endif ( )
elseif ( ARGV0 STREQUAL "GENERATE" )
cmake_parse_arguments (
PARSE_ARGV 2
_ARGS
"COMPRESS"
"MAJOR;MINOR;PATCH;TWEAK;PRERELEASE;BUILD"
""
)
# Do we have the major component, and is it valid?
if ( DEFINED _ARGS_MAJOR )
string ( STRIP "${_ARGS_MAJOR}" _ARGS_MAJOR )
if ( _ARGS_MAJOR STREQUAL "" )
set ( _ARGS_MAJOR 0 )
elseif ( NOT ( _ARGS_MAJOR MATCHES [[^[0-9]+ $ ]] ) )
set ( ${ OUT_VAR } _ERROR "MAJOR component must be a numeric identifier, but is: '${_ARGS_MAJOR}'" PARENT_SCOPE )
return ( )
endif ( )
else ( )
set ( _ARGS_MAJOR 0 )
endif ( )
set ( _ "${_}${_ARGS_MAJOR}" )
# Do we have the minor component, and is it valid?
if ( DEFINED _ARGS_MINOR )
string ( STRIP "${_ARGS_MINOR}" _ARGS_MINOR )
if ( _ARGS_MINOR STREQUAL "" )
set ( _ARGS_MINOR 0 )
elseif ( NOT ( _ARGS_MINOR MATCHES [[^[0-9]+ $ ]] ) )
set ( ${ OUT_VAR } _ERROR "MINOR component must be a numeric identifier, but is: '${_ARGS_MINOR}'" PARENT_SCOPE )
return ( )
endif ( )
else ( )
set ( _ARGS_MINOR 0 )
endif ( )
set ( _ "${_}.${_ARGS_MINOR}" )
# Do we have the patch component, and is it valid?
if ( DEFINED _ARGS_PATCH )
string ( STRIP "${_ARGS_PATCH}" _ARGS_PATCH )
if ( _ARGS_PATCH STREQUAL "" )
unset ( _ARGS_PATCH )
elseif ( _ARGS_PATCH MATCHES [[^[0-9]+ $ ]] )
set ( _ "${_}.${_ARGS_PATCH}" )
else ( )
set ( ${ OUT_VAR } _ERROR "PATCH component must be a numeric identifier, but is: '${_ARGS_PATCH}'" PARENT_SCOPE )
return ( )
endif ( )
endif ( )
# Do we have the tweak component, and is it valid?
if ( DEFINED _ARGS_TWEAK )
string ( STRIP "${_ARGS_TWEAK}" _ARGS_TWEAK )
if ( _ARGS_TWEAK STREQUAL "" )
unset ( _ARGS_TWEAK )
elseif ( _ARGS_TWEAK MATCHES [[^[0-9]+ $ ]] )
if ( NOT DEFINED _ARGS_PATCH )
set ( _ "${_}.0" )
endif ( )
set ( _ "${_}.${_ARGS_TWEAK}" )
else ( )
set ( ${ OUT_VAR } _ERROR "TWEAK component must be a numeric identifier, but is: '${_ARGS_TWEAK}'" PARENT_SCOPE )
return ( )
endif ( )
endif ( )
# Do we have the pre-release component, and is it valid?
if ( DEFINED _ARGS_PRERELEASE )
string ( STRIP "${_ARGS_PRERELEASE}" _ARGS_PRERELEASE )
if ( _ARGS_PRERELEASE STREQUAL "" )
unset ( _ARGS_PRERELEASE )
elseif ( _ARGS_PRERELEASE MATCHES [[^[a-zA-Z0-9]+[a-zA-Z0-9\-\.]* $ ]] )
if ( _ARGS_COMPRESS AND ( _ARGS_PRERELEASE MATCHES [[[a-zA-Z]+[a-zA-Z0-9\\-\\.]* $ ]] ) )
set ( _ "${_}${_ARGS_PRERELEASE}" )
else ( )
set ( _ "${_}-${_ARGS_PRERELEASE}" )
endif ( )
else ( )
set ( ${ OUT_VAR } _ERROR "PRERELEASE component must be an alphanumeric identifier, but is: '${_ARGS_PRERELEASE}'" PARENT_SCOPE )
return ( )
endif ( )
endif ( )
# Do we have the build component, and is it valid?
if ( DEFINED _ARGS_BUILD )
string ( STRIP "${_ARGS_BUILD}" _ARGS_PRERELEASE )
if ( _ARGS_BUILD STREQUAL "" )
unset ( _ARGS_BUILD )
elseif ( _ARGS_BUILD MATCHES [[^[a-zA-Z0-9]+[a-zA-Z0-9\-\.]* $ ]] )
set ( _ "${_}+${_ARGS_BUILD}" )
else ( )
set ( ${ OUT_VAR } _ERROR "BUILD component must be an alphanumeric identifier, but is: '${_ARGS_BUILD}'" PARENT_SCOPE )
return ( )
endif ( )
endif ( )
set ( ${ OUT_VAR } "${_}" PARENT_SCOPE )
elseif ( ARGV0 STREQUAL "MODIFY" )
# Requires PARSE and GENERATE.
cmake_parse_arguments (
PARSE_ARGV 3
_ARGS
"COMPRESS"
"MAJOR;MINOR;PATCH;BUILD;PRERELEASE;COMMIT"
""
)
# Helpers
macro ( modify_version_number )
if ( DEFINED ${ ARGV1 } )
if ( ${ ARGV1 } MATCHES "^(\\+|\\-)([0-9]+)$" )
if ( DEFINED ${ ARGV0 } )
math ( EXPR ${ ARGV0 } "${${ARGV0}} ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}" )
else ( )
math ( EXPR ${ ARGV0 } "0 ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}" )
endif ( )
else ( )
set ( ${ ARGV0 } "${${ARGV1}}" )
endif ( )
endif ( )
endmacro ( )
# Parse the given version.
version ( PARSE _TEMP "${ARGV2}" )
if ( DEFINED _TEMP_ERROR )
set ( ${ OUT_VAR } _ERROR ${ _TEMP_ERROR } PARENT_SCOPE )
return ( )
endif ( )
# Modify core version components
modify_version_number ( _TEMP_MAJOR _ARGS_MAJOR )
modify_version_number ( _TEMP_MINOR _ARGS_MINOR )
modify_version_number ( _TEMP_PATCH _ARGS_PATCH )
modify_version_number ( _TEMP_TWEAK _ARGS_TWEAK )
# Replace other components if defined.
if ( DEFINED _ARGS_PRERELEASE )
set ( _TEMP_PRERELEASE "${_ARGS_PRERELEASE}" )
endif ( )
if ( DEFINED _ARGS_BUILD )
set ( _TEMP_BUILD "${_ARGS_BUILD}" )
endif ( )
# Generate a new version.
set ( _ARGS "" )
if ( DEFINED _TEMP_MAJOR AND ( NOT _TEMP_MAJOR STREQUAL "" ) )
set ( _ARGS "${_ARGS} MAJOR \" ${ _TEMP_MAJOR } \"")
endif( )
if ( DEFINED _TEMP_MINOR AND ( NOT _TEMP_MINOR STREQUAL "" ) )
set ( _ARGS "${_ARGS} MINOR \" ${ _TEMP_MINOR } \"")
endif( )
if ( DEFINED _TEMP_PATCH AND ( NOT _TEMP_PATCH STREQUAL "" ) )
set ( _ARGS "${_ARGS} PATCH \" ${ _TEMP_PATCH } \"")
endif( )
if ( DEFINED _TEMP_TWEAK AND ( NOT _TEMP_TWEAK STREQUAL "" ) )
set ( _ARGS "${_ARGS} TWEAK \" ${ _TEMP_TWEAK } \"")
endif( )
if ( DEFINED _TEMP_PRERELEASE AND ( NOT _TEMP_PRERELEASE STREQUAL "" ) )
set ( _ARGS "${_ARGS} PRERELEASE \" ${ _TEMP_PRERELEASE } \"")
endif( )
if ( DEFINED _TEMP_BUILD AND ( NOT _TEMP_BUILD STREQUAL "" ) )
set ( _ARGS "${_ARGS} BUILD \" ${ _TEMP_BUILD } \"")
endif( )
if ( DEFINED _ARGS_COMPRESS )
set ( _ARGS "${_ARGS} COMPRESS" )
endif ( )
cmake_language ( EVAL CODE "version(GENERATE _TEMP ${_ARGS})" )
if ( DEFINED _TEMP_ERROR )
set ( ${ OUT_VAR } _ERROR ${ _TEMP_ERROR } PARENT_SCOPE )
return ( )
endif ( )
set ( ${ OUT_VAR } "${_TEMP}" PARENT_SCOPE )
elseif ( ARGV0 STREQUAL "COMPARE" )
# Requires PARSE.
# Parse first version
version ( PARSE _A "${ARGV2}" )
if ( DEFINED _A_ERROR )
set ( ${ OUT_VAR } _ERROR ${ _A_ERROR } PARENT_SCOPE )
return ( )
endif ( )
# Parse second version
version ( PARSE _B "${ARGV3}" )
if ( DEFINED _B_ERROR )
set ( ${ OUT_VAR } _ERROR ${ _B_ERROR } PARENT_SCOPE )
return ( )
endif ( )
# Major
if ( _A_MAJOR GREATER _B_MAJOR )
set ( ${ OUT_VAR } ">MAJOR" PARENT_SCOPE )
return ( )
elseif ( _A_MAJOR LESS _B_MAJOR )
set ( ${ OUT_VAR } "<MAJOR" PARENT_SCOPE )
return ( )
endif ( )
# Minor
if ( _A_MINOR GREATER _B_MINOR )
set ( ${ OUT_VAR } ">MINOR" PARENT_SCOPE )
return ( )
elseif ( _A_MINOR LESS _B_MINOR )
set ( ${ OUT_VAR } "<MINOR" PARENT_SCOPE )
return ( )
endif ( )
# Patch
if ( ( DEFINED _A_PATCH OR DEFINED _B_PATCH ) AND ( ( NOT DEFINED _A_PATCH ) OR ( NOT DEFINED _B_PATCH ) ) )
if ( DEFINED _A_PATCH )
set ( ${ OUT_VAR } "+PATCH" PARENT_SCOPE )
else ( )
set ( ${ OUT_VAR } "-PATCH" PARENT_SCOPE )
endif ( )
return ( )
elseif ( _A_PATCH GREATER _B_PATCH )
set ( ${ OUT_VAR } ">PATCH" PARENT_SCOPE )
return ( )
elseif ( _A_PATCH LESS _B_PATCH )
set ( ${ OUT_VAR } "<PATCH" PARENT_SCOPE )
return ( )
endif ( )
# Tweak
if ( ( DEFINED _A_TWEAK OR DEFINED _B_TWEAK ) AND ( ( NOT DEFINED _A_TWEAK ) OR ( NOT DEFINED _B_TWEAK ) ) )
if ( DEFINED _A_TWEAK )
set ( ${ OUT_VAR } "+TWEAK" PARENT_SCOPE )
else ( )
set ( ${ OUT_VAR } "-TWEAK" PARENT_SCOPE )
endif ( )
return ( )
elseif ( _A_TWEAK GREATER _B_TWEAK )
set ( ${ OUT_VAR } ">TWEAK" PARENT_SCOPE )
return ( )
elseif ( _A_TWEAK LESS _B_TWEAK )
set ( ${ OUT_VAR } "<TWEAK" PARENT_SCOPE )
return ( )
endif ( )
# Pre-Release
if ( ( DEFINED _A_PRERELEASE ) AND ( DEFINED _B_PRERELEASE ) AND ( NOT ( _A_PRERELEASE STREQUAL _B_PRERELEASE ) ) )
set ( ${ OUT_VAR } "PRERELEASE" PARENT_SCOPE )
return ( )
elseif ( ( DEFINED _A_PRERELEASE OR DEFINED _B_PRERELEASE ) AND ( ( NOT DEFINED _A_PRERELEASE ) OR ( NOT DEFINED _B_PRERELEASE ) ) )
if ( DEFINED _A_PRERELEASE )
set ( ${ OUT_VAR } "+PRERELEASE" PARENT_SCOPE )
else ( )
set ( ${ OUT_VAR } "-PRERELEASE" PARENT_SCOPE )
endif ( )
return ( )
endif ( )
# Build
if ( ( DEFINED _A_BUILD ) AND ( DEFINED _B_BUILD ) AND ( NOT ( _A_BUILD STREQUAL _B_BUILD ) ) )
set ( ${ OUT_VAR } "BUILD" PARENT_SCOPE )
return ( )
elseif ( ( DEFINED _A_BUILD OR DEFINED _B_BUILD ) AND ( ( NOT DEFINED _A_BUILD ) OR ( NOT DEFINED _B_BUILD ) ) )
if ( DEFINED _A_BUILD )
set ( ${ OUT_VAR } "+BUILD" PARENT_SCOPE )
else ( )
set ( ${ OUT_VAR } "-BUILD" PARENT_SCOPE )
endif ( )
return ( )
endif ( )
# Both are exactly the same.
set ( ${ OUT_VAR } "" PARENT_SCOPE )
else ( )
message ( FATAL_ERROR "Unknown command '${ARGV0}'" )
return ( )
endif ( )
endfunction ( )