use inline 'libraryVersion()' function (closes #858)

This commit is contained in:
Kevin Ushey 2017-03-16 11:17:45 -07:00 committed by Martin Hořeňovský
parent cffb031ce1
commit e04dc5105b
5 changed files with 8 additions and 5 deletions

View File

@ -125,7 +125,7 @@ namespace Catch {
}
void showHelp( std::string const& processName ) {
Catch::cout() << "\nCatch v" << libraryVersion << "\n";
Catch::cout() << "\nCatch v" << libraryVersion() << "\n";
m_cli.usage( Catch::cout(), processName );
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;

View File

@ -32,7 +32,7 @@ namespace Catch {
void operator=( Version const& );
};
extern Version libraryVersion;
inline Version libraryVersion();
}
#endif // TWOBLUECUBES_CATCH_VERSION_H_INCLUDED

View File

@ -37,7 +37,10 @@ namespace Catch {
return os;
}
Version libraryVersion( 1, 8, 2, "", 0 );
inline Version libraryVersion() {
static Version version(1, 8, 2, "", 0);
return version;
}
}

View File

@ -254,7 +254,7 @@ namespace Catch {
stream << '\n' << getLineOfChars<'~'>() << '\n';
Colour colour( Colour::SecondaryText );
stream << currentTestRunInfo->name
<< " is a Catch v" << libraryVersion << " host application.\n"
<< " is a Catch v" << libraryVersion() << " host application.\n"
<< "Run with -? for options\n\n";
if( m_config->rngSeed() != 0 )

View File

@ -7,7 +7,7 @@ import string
from scriptCommon import catchPath
versionParser = re.compile( r'(\s*Version\slibraryVersion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*,\s*(.*)\s*\).*' )
versionParser = re.compile( r'(\s*static\sVersion\sversion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*,\s*(.*)\s*\).*' )
rootPath = os.path.join( catchPath, 'include/' )
versionPath = os.path.join( rootPath, "internal/catch_version.hpp" )
readmePath = os.path.join( catchPath, "README.md" )