PACKAGE_VERSION_PATCH
)
-set (PACKAGE_SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
+# shared library ABI version number, can be overridden by package maintainers
+# using -DGFLAGS_SOVERSION=XXX on the command-line
+if (GFLAGS_SOVERSION)
+ set (PACKAGE_SOVERSION "${GFLAGS_SOVERSION}")
+else ()
- set (PACKAGE_SOVERSION "${PACKAGE_VERSION_MAJOR}")
++ # TODO: Change default SOVERSION back to PACKAGE_VERSION_MAJOR with the
++ # next increase of major version number (i.e., 3.0.0 -> SOVERSION 3)
++ # The <major>.<minor> SOVERSION should be used for the 2.x releases
++ # versions only which temporarily broke the API by changing the default
++ # namespace from "google" to "gflags".
++ set (PACKAGE_SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
+endif ()
+
+# when gflags is included as subproject (e.g., as Git submodule/subtree) in the source
+# tree of a project that uses it, no variables should be added to the CMake cache;
+# users may set the non-cached variable GFLAGS_IS_SUBPROJECT before add_subdirectory(gflags)
+if (NOT DEFINED GFLAGS_IS_SUBPROJECT)
+ if ("^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$")
+ set (GFLAGS_IS_SUBPROJECT FALSE)
+ else ()
+ set (GFLAGS_IS_SUBPROJECT TRUE)
+ endif ()
+endif ()
+
+# prefix for package variables in CMake configuration file
+string (TOUPPER "${PACKAGE_NAME}" PACKAGE_PREFIX)
# ----------------------------------------------------------------------------
# options