Skip to content

Commit

Permalink
Use the version specified in CMakeLists.txt
Browse files Browse the repository at this point in the history
Signed-off-by: Kunlin Yu <[email protected]>
  • Loading branch information
kunlinyu committed Jan 4, 2025
1 parent 7aa550d commit c52d120
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project(cql2cpp
HOMEPAGE_URL "https://github.com/IndoorSpatial/cql2cpp"
LANGUAGES CXX
)
add_definitions(-DVERSION="${PROJECT_VERSION}")

find_package(GTest REQUIRED)
find_package(geos REQUIRED)
Expand Down
6 changes: 6 additions & 0 deletions include/cql2cpp/cql2cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#include "global_yylex.h"
#include "tree_dot.h"

#ifndef VERSION
#define VERSION "0.0.0"
#endif

namespace cql2cpp {

template <typename FeatureType>
Expand Down Expand Up @@ -113,6 +117,8 @@ class Cql2Cpp {
return true;
}

static std::string version() { return VERSION; }

private:
static bool Parse(const std::string& cql2_query, AstNodePtr* root,
std::string* error_msg) {
Expand Down
6 changes: 5 additions & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#include <fstream>

#ifndef VERSION
#define VERSION "0.0.0"
#endif

DEFINE_string(query, "", "cql2 query string");
DEFINE_string(geojson, "",
"geojson data set with multiple features in one feature "
Expand All @@ -35,7 +39,7 @@ int main(int argc, char** argv) {
gflags::SetUsageMessage(
"Usage: cql2 -query=\"city='Toronto'\" "
"-geojson=\"path/to/feature_collection.geojson\" -index=0");
gflags::SetVersionString("0.1.0");
gflags::SetVersionString(VERSION);
gflags::ParseCommandLineFlags(&argc, &argv, true);

google::InitGoogleLogging(argv[0]);
Expand Down

0 comments on commit c52d120

Please sign in to comment.