Skip to content

Commit 4129468

Browse files
authoredFeb 26, 2024··
Merge pull request #9313 from rouault/flatbuffers_namespacing
Make sure our vendored flatbuffers copy has a unique namespace
2 parents 23d0edd + f304ca5 commit 4129468

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
 

‎ogr/ogrsf_frmts/flatgeobuf/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ add_gdal_driver(
1111
gdal_standard_includes(ogr_FlatGeobuf)
1212
target_include_directories(ogr_FlatGeobuf PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
1313
$<TARGET_PROPERTY:ogrsf_generic,SOURCE_DIR>)
14+
# Quick and dirty way of modifying the default flatbuffers namespace to gdal_flatbuffers
15+
target_compile_definitions(ogr_FlatGeobuf PRIVATE -Dflatbuffers=gdal_flatbuffers)

‎ogr/ogrsf_frmts/flatgeobuf/ogrflatgeobufdataset.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232

3333
#include "header_generated.h"
3434

35+
// For users not using CMake...
36+
#ifndef flatbuffers
37+
#error \
38+
"Make sure to build with -Dflatbuffers=gdal_flatbuffers (for example) to avoid potential conflict of flatbuffers"
39+
#endif
40+
3541
using namespace flatbuffers;
3642
using namespace FlatGeobuf;
3743

‎scripts/cppcheck.sh

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ for dirname in alg port gcore ogr frmts gnm apps fuzzers; do
9898
-D__x86_64__ \
9999
-DFLT_EVAL_METHOD \
100100
-DKDU_HAS_ROI_RECT \
101+
-Dflatbuffers=gdal_flatbuffers \
101102
--include="${CPL_CONFIG_H}" \
102103
--include=port/cpl_port.h \
103104
-I "${CPL_CONFIG_H_DIR}" \

0 commit comments

Comments
 (0)
Please sign in to comment.