From 17470a5765be3c9dcd6316722e4237f32e698718 Mon Sep 17 00:00:00 2001
From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl>
Date: Thu, 15 Sep 2011 13:17:25 +0200
Subject: [PATCH] fix build for version info

---
 CMakeLists.txt               | 4 ----
 corpus2tools/CMakeLists.txt  | 1 +
 corpus2tools/tagset-tool.cpp | 9 ++++++++-
 libcorpus2/util/settings.cpp | 7 -------
 libcorpus2/util/settings.h   | 6 ------
 5 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d10cd8..c908963 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,10 +4,6 @@ set(corpus2_ver_major "1")
 set(corpus2_ver_minor "0")
 set(corpus2_ver_patch "12")
 
-add_definitions(-DLIBCORPUS2_VERSION_MAJOR=${corpus2_ver_major})
-add_definitions(-DLIBCORPUS2_VERSION_MINOR=${corpus2_ver_minor})
-add_definitions(-DLIBCORPUS2_VERSION_PATCH=${corpus2_ver_patch})
-
 cmake_minimum_required(VERSION 2.8.0)
 
 # use some of our own Find* scripts
diff --git a/corpus2tools/CMakeLists.txt b/corpus2tools/CMakeLists.txt
index 7a43deb..40508ee 100644
--- a/corpus2tools/CMakeLists.txt
+++ b/corpus2tools/CMakeLists.txt
@@ -8,6 +8,7 @@ if (Libedit_FOUND)
 endif (Libedit_FOUND)
 
 include_directories( ${CMAKE_SOURCE_DIR} )
+include_directories(${corpus2_BINARY_DIR}/include)
 
 add_executable( tagset-tool tagset-tool.cpp )
 target_link_libraries ( tagset-tool corpus2 pwrutils ${Boost_LIBRARIES} ${LIBS})
diff --git a/corpus2tools/tagset-tool.cpp b/corpus2tools/tagset-tool.cpp
index 7968b78..7ab4395 100644
--- a/corpus2tools/tagset-tool.cpp
+++ b/corpus2tools/tagset-tool.cpp
@@ -32,6 +32,13 @@ or FITNESS FOR A PARTICULAR PURPOSE.
 #include <histedit.h>
 #endif
 
+#ifdef HAVE_CONFIG_D_H
+#include <libcorpus2/config_d.h>
+#endif
+
+// not checking for HAVE_VERSION, there is no reason it shouldn't be there
+#include <libcorpus2/version.h>
+
 namespace {
 	const char* _prompt = "> ";
 }
@@ -246,7 +253,7 @@ int main(int argc, char** argv)
 		return 1;
 	}
 	if (vm.count("version")) {
-		std::cout << "tagset-tool (libcorpus2) " << Corpus2::version_string() << "\n";
+		std::cout << "tagset-tool (libcorpus2) " << LIBCORPUS2_VERSION << "\n";
 		return 0;
 	}
 
diff --git a/libcorpus2/util/settings.cpp b/libcorpus2/util/settings.cpp
index c6c7309..9ee485b 100644
--- a/libcorpus2/util/settings.cpp
+++ b/libcorpus2/util/settings.cpp
@@ -28,13 +28,6 @@ or FITNESS FOR A PARTICULAR PURPOSE.
 
 namespace Corpus2 {
 
-const std::string version_string()
-{
-	std::stringstream version;
-	version << version_major << "." << version_minor << "." << version_patch;
-	return version.str();
-}
-
 Corpus2PathSearcher::Corpus2PathSearcher()
 	: PwrNlp::PathSearcher<FileNotFound>(LIBCORPUS2_PATH_SEPARATOR)
 {
diff --git a/libcorpus2/util/settings.h b/libcorpus2/util/settings.h
index e952a70..1dd5772 100644
--- a/libcorpus2/util/settings.h
+++ b/libcorpus2/util/settings.h
@@ -23,12 +23,6 @@ or FITNESS FOR A PARTICULAR PURPOSE.
 
 namespace Corpus2 {
 
-const int version_major = (LIBCORPUS2_VERSION_MAJOR);
-const int version_minor = (LIBCORPUS2_VERSION_MINOR);
-const int version_patch = (LIBCORPUS2_VERSION_PATCH);
-
-const std::string version_string();
-
 class Corpus2PathSearcher : public PwrNlp::PathSearcher<FileNotFound>
 {
 public:
-- 
GitLab