Set up for Bazel module builds. (#1597)
* Set up for Bazel module builds.
Note: the MODULE.bazel is copied from https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/jsoncpp/1.9.6/MODULE.bazel
* More tweaks to .gitignore
diff --git a/.gitignore b/.gitignore
index 9682782..69868f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,7 @@
# temps
/version
+
+# Bazel output paths
+/bazel-*
+/MODULE.bazel.lock
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6104c5c..5ab9c52 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,12 +55,13 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(jsoncpp
- # Note: version must be updated in three places when doing a release. This
+ # Note: version must be updated in four places when doing a release. This
# annoying process ensures that amalgamate, CMake, and meson all report the
# correct version.
# 1. ./meson.build
# 2. ./include/json/version.h
# 3. ./CMakeLists.txt
+ # 4. ./MODULE.bazel
# IMPORTANT: also update the PROJECT_SOVERSION!!
VERSION 1.9.7 # <major>[.<minor>[.<patch>[.<tweak>]]]
LANGUAGES CXX)
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..03f192d
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,14 @@
+module(
+ name = "jsoncpp",
+
+ # Note: version must be updated in four places when doing a release. This
+ # annoying process ensures that amalgamate, CMake, and meson all report the
+ # correct version.
+ # 1. /meson.build
+ # 2. /include/json/version.h
+ # 3. /CMakeLists.txt
+ # 4. /MODULE.bazel
+ # IMPORTANT: also update the SOVERSION!!
+ version = "1.9.7",
+ compatibility_level = 1,
+)
diff --git a/include/json/version.h b/include/json/version.h
index 42e8780..555152c 100644
--- a/include/json/version.h
+++ b/include/json/version.h
@@ -1,12 +1,13 @@
#ifndef JSON_VERSION_H_INCLUDED
#define JSON_VERSION_H_INCLUDED
-// Note: version must be updated in three places when doing a release. This
+// Note: version must be updated in four places when doing a release. This
// annoying process ensures that amalgamate, CMake, and meson all report the
// correct version.
// 1. /meson.build
// 2. /include/json/version.h
// 3. /CMakeLists.txt
+// 4. /MODULE.bazel
// IMPORTANT: also update the SOVERSION!!
#define JSONCPP_VERSION_STRING "1.9.7"
diff --git a/meson.build b/meson.build
index 8e8d57e..2648c30 100644
--- a/meson.build
+++ b/meson.build
@@ -2,12 +2,13 @@
'jsoncpp',
'cpp',
- # Note: version must be updated in three places when doing a release. This
+ # Note: version must be updated in four places when doing a release. This
# annoying process ensures that amalgamate, CMake, and meson all report the
# correct version.
# 1. /meson.build
# 2. /include/json/version.h
# 3. /CMakeLists.txt
+ # 4. /MODULE.bazel
# IMPORTANT: also update the SOVERSION!!
version : '1.9.7',
default_options : [