Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorKevin Ushey2017-03-16 11:17:45 -0700
committerMartin Hořeňovský2017-03-22 15:51:02 +0100
commite04dc5105b537fb980f9d9d4aefb3d236433f9cb (patch)
treea971e0e74806718f4746f7315f4afd8e76b9c1a2 /include
parentcffb031ce1182ba0289f8bd9836107c078950cca (diff)
downloadcatch3-e04dc5105b537fb980f9d9d4aefb3d236433f9cb.tar.gz
use inline 'libraryVersion()' function (closes #858)
Diffstat (limited to 'include')
-rw-r--r--include/catch_session.hpp2
-rw-r--r--include/internal/catch_version.h2
-rw-r--r--include/internal/catch_version.hpp5
-rw-r--r--include/reporters/catch_reporter_console.hpp2
4 files changed, 7 insertions, 4 deletions
diff --git a/include/catch_session.hpp b/include/catch_session.hpp
index a9c33664..be51bef8 100644
--- a/include/catch_session.hpp
+++ b/include/catch_session.hpp
@@ -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;
diff --git a/include/internal/catch_version.h b/include/internal/catch_version.h
index 1a79c5c5..09032d68 100644
--- a/include/internal/catch_version.h
+++ b/include/internal/catch_version.h
@@ -32,7 +32,7 @@ namespace Catch {
void operator=( Version const& );
};
- extern Version libraryVersion;
+ inline Version libraryVersion();
}
#endif // TWOBLUECUBES_CATCH_VERSION_H_INCLUDED
diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp
index e8e2f764..2af86348 100644
--- a/include/internal/catch_version.hpp
+++ b/include/internal/catch_version.hpp
@@ -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;
+ }
}
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index 711d7fbe..fed97072 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -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 )