diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ec3f24..239c8b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,13 @@ cmake_minimum_required(VERSION 2.8) project(semver) set(VERSION_MAJOR "1") -set(VERSION_MINOR "0") +set(VERSION_MINOR "1") set(VERSION_PATCH "0") set(VERSION_RELEASE "") set(VERSION_BUILD "") +option(SEMVER_ENABLE_TESTING "Adds tests subdirectory and enables testing" OFF) + # Build full version string, including optional components string(COMPARE NOTEQUAL VERSION_RELEASE "" HAVE_RELEASE) string(COMPARE NOTEQUAL VERSION_BUILD "" HAVE_BUILD) @@ -32,10 +34,13 @@ if(MSVC) endif() add_subdirectory(src) -add_subdirectory(test) -enable_testing() -add_test(NAME semver200_parser_tests COMMAND semver200_parser_tests) -add_test(NAME semver200_comparator_tests COMMAND semver200_comparator_tests) -add_test(NAME semver200_version_tests COMMAND semver200_version_tests) -add_test(NAME semver200_modifier_tests COMMAND semver200_modifier_tests) +if (SEMVER_ENABLE_TESTING) + add_subdirectory(test) + + enable_testing() + add_test(NAME semver200_parser_tests COMMAND semver200_parser_tests) + add_test(NAME semver200_comparator_tests COMMAND semver200_comparator_tests) + add_test(NAME semver200_version_tests COMMAND semver200_version_tests) + add_test(NAME semver200_modifier_tests COMMAND semver200_modifier_tests) +endif() diff --git a/README.md b/README.md index 5d0997c..2119bf7 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ The code is written in C++14, so, fairly recent compiler is required to build it - GCC 5.1.1 - Clang 3.7.0 -Library itself does not have any external dependencies. Unit tests that verify the library work as expected, on the other hand, depend on the [Boost.Test](http://www.boost.org/doc/libs/1_59_0/libs/test/doc/html/index.html) library. If you do not have and do not want to install Boost.Test, then comment out appropriate section of CMakeLists.txt file. +Library itself does not have any external dependencies. Unit tests that verify the library work as expected, on the other hand, depend on the [Boost.Test](http://www.boost.org/doc/libs/1_59_0/libs/test/doc/html/index.html) library. Unit tests are disabled by default. To build tests run cmake with -DSEMVER_ENABLE_TESTING=ON option. The code comes with CMake project files. In order to build it you should: