diff --git a/.gitignore b/.gitignore index 726b1a3..0de87d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ build/ -include/yaml-cpp/version.h +test/version_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 873d6b0..1897775 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,8 +116,6 @@ include_directories(${YAML_CPP_SOURCE_DIR}/include) find_package(Boost REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) -# Create version.h -configure_file(${header_directory}/version.h.in ${CMAKE_SOURCE_DIR}/${header_directory}/version.h) ### ### General compilation settings diff --git a/include/yaml-cpp/version.h.in b/include/yaml-cpp/version.h similarity index 63% rename from include/yaml-cpp/version.h.in rename to include/yaml-cpp/version.h index 1b60ebb..a3d9afd 100644 --- a/include/yaml-cpp/version.h.in +++ b/include/yaml-cpp/version.h @@ -7,11 +7,11 @@ #pragma once #endif -#define YAML_CPP_VERSION_MAJOR ${YAML_CPP_VERSION_MAJOR} -#define YAML_CPP_VERSION_MINOR ${YAML_CPP_VERSION_MINOR} -#define YAML_CPP_VERSION_PATCH ${YAML_CPP_VERSION_PATCH} +#define YAML_CPP_VERSION_MAJOR 0 +#define YAML_CPP_VERSION_MINOR 5 +#define YAML_CPP_VERSION_PATCH 2 // String representation of the current version (ie. "0.1.2") -#define YAML_CPP_VERSION "${YAML_CPP_VERSION}" +#define YAML_CPP_VERSION "0.5.2" #endif // YAML_CPP_VERSION_H diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 61f1f7f..07e008a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,6 +13,9 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR set(yaml_test_flags "-Wno-c99-extensions -Wno-variadic-macros -Wno-sign-compare") endif() +# Create version_test.cpp +configure_file(${YAML_CPP_SOURCE_DIR}/test/version_test.cpp.in ${YAML_CPP_SOURCE_DIR}/test/version_test.cpp) + file(GLOB test_headers [a-z_]*.h) file(GLOB test_sources [a-z_]*.cpp integration/[a-z_]*.cpp node/[a-z_]*.cpp) file(GLOB test_new_api_sources new-api/[a-z]*.cpp) diff --git a/test/version_test.cpp b/test/version_test.cpp deleted file mode 100644 index b55cc25..0000000 --- a/test/version_test.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "yaml-cpp/version.h" - -#include "gtest/gtest.h" - -namespace YAML { -namespace { -TEST(VersionTest, Major) -{ - ASSERT_EQ(YAML_CPP_VERSION_MAJOR, 0); -} - -TEST(VersionTest, Minor) -{ - ASSERT_EQ(YAML_CPP_VERSION_MINOR, 5); -} - -TEST(VersionTest, Path) -{ - ASSERT_EQ(YAML_CPP_VERSION_PATCH, 2); -} - -TEST(VersionTest, String) -{ - ASSERT_STREQ(YAML_CPP_VERSION, "0.5.2"); -} -} -} diff --git a/test/version_test.cpp.in b/test/version_test.cpp.in new file mode 100644 index 0000000..576b827 --- /dev/null +++ b/test/version_test.cpp.in @@ -0,0 +1,27 @@ +#include "yaml-cpp/version.h" + +#include "gtest/gtest.h" + +namespace YAML { +namespace { +TEST(VersionTest, Major) +{ + ASSERT_EQ(${YAML_CPP_VERSION_MAJOR}, YAML_CPP_VERSION_MAJOR); +} + +TEST(VersionTest, Minor) +{ + ASSERT_EQ(${YAML_CPP_VERSION_MINOR}, YAML_CPP_VERSION_MINOR); +} + +TEST(VersionTest, Path) +{ + ASSERT_EQ(${YAML_CPP_VERSION_PATCH}, YAML_CPP_VERSION_PATCH); +} + +TEST(VersionTest, String) +{ + ASSERT_STREQ("${YAML_CPP_VERSION}", YAML_CPP_VERSION); +} +} +}