feat: add Json::version() to expose runtime version (#1531)

This adds a runtime function `Json::version()` that returns the `JSONCPP_VERSION_STRING`.

This allows a program using jsoncpp to display the version information of the runtime linked shared library, or check at runtime that the version of the shared library is compatible with what the program expects.

Fixes #1531
diff --git a/include/json/config.h b/include/json/config.h
index 6971fa6..4619e93 100644
--- a/include/json/config.h
+++ b/include/json/config.h
@@ -105,6 +105,7 @@
 #endif // if !defined(JSON_IS_AMALGAMATION)
 
 namespace Json {
+JSON_API const char* version();
 using Int = int;
 using UInt = unsigned int;
 #if defined(JSON_NO_INT64)
diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp
index a8eb72d..f3e070e 100644
--- a/src/lib_json/json_value.cpp
+++ b/src/lib_json/json_value.cpp
@@ -1708,4 +1708,6 @@
   return *node;
 }
 
+const char* version() { return JSONCPP_VERSION_STRING; }
+
 } // namespace Json
diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp
index d6938c1..4c000fa 100644
--- a/src/test_lib_json/main.cpp
+++ b/src/test_lib_json/main.cpp
@@ -4188,6 +4188,11 @@
   JSONTEST_ASSERT_EQUAL(vstr.str(), std::string(JSONCPP_VERSION_STRING));
 }
 
+JSONTEST_FIXTURE_LOCAL(VersionTest, RuntimeVersionString) {
+  JSONTEST_ASSERT_EQUAL(std::string(JSONCPP_VERSION_STRING),
+                        std::string(Json::version()));
+}
+
 #if defined(__GNUC__)
 #pragma GCC diagnostic pop
 #endif