diff --git a/.appveyor.yml b/.appveyor.yml index 2bc97fd..ccfb904 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,6 +3,7 @@ os: - Visual Studio 2017 build_script: + - git submodule update --init --recursive - mkdir build - cd build - cmake .. diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e6488b5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cmake/tl-cmake"] + path = cmake/tl-cmake + url = https://github.com/TartanLlama/tl-cmake.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 5352502..18246ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,14 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.8) -project(optional) +project(tl-optional VERSION 1.0.0 LANGUAGES CXX) option(OPTIONAL_ENABLE_TESTS "Enable tests." ON) -add_library(optional INTERFACE) -target_sources(optional INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/tl/optional.hpp) -target_include_directories(optional INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/tl) +set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/tl-cmake" ${CMAKE_MODULE_PATH}) +include(add-tl) + +tl_add_library(optional SOURCES + include/tl/optional.hpp) if(OPTIONAL_ENABLE_TESTS) # Prepare "Catch" library for other executables diff --git a/cmake/tl-cmake b/cmake/tl-cmake new file mode 160000 index 0000000..576e25f --- /dev/null +++ b/cmake/tl-cmake @@ -0,0 +1 @@ +Subproject commit 576e25feabec4c79ebe2cf7174398c61de05d384 diff --git a/cmake/tl-optional-config.cmake.in b/cmake/tl-optional-config.cmake.in new file mode 100644 index 0000000..cc57bdf --- /dev/null +++ b/cmake/tl-optional-config.cmake.in @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/tl-optional-targets.cmake") \ No newline at end of file diff --git a/tl/optional.hpp b/include/tl/optional.hpp similarity index 99% rename from tl/optional.hpp rename to include/tl/optional.hpp index e33682c..4b9cee8 100644 --- a/tl/optional.hpp +++ b/include/tl/optional.hpp @@ -15,8 +15,9 @@ #ifndef TL_OPTIONAL_HPP #define TL_OPTIONAL_HPP -#define TL_OPTIONAL_VERSION_MAJOR 0 -#define TL_OPTIONAL_VERSION_MINOR 5 +#define TL_OPTIONAL_VERSION_MAJOR 1 +#define TL_OPTIONAL_VERSION_MINOR 0 +#define TL_OPTIONAL_VERSION_PATCH 0 #include #include diff --git a/tests/assignment.cpp b/tests/assignment.cpp index 205ed7b..781be33 100644 --- a/tests/assignment.cpp +++ b/tests/assignment.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include TEST_CASE("Assignment value", "[assignment.value]") { tl::optional o1 = 42; diff --git a/tests/bases.cpp b/tests/bases.cpp index cff7819..7973b8c 100644 --- a/tests/bases.cpp +++ b/tests/bases.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include // Old versions of GCC don't have the correct trait names. Could fix them up if needs be. #if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \ diff --git a/tests/constexpr.cpp b/tests/constexpr.cpp index dc4db43..efd916c 100644 --- a/tests/constexpr.cpp +++ b/tests/constexpr.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include #define TOKENPASTE(x, y) x##y #define TOKENPASTE2(x, y) TOKENPASTE(x, y) diff --git a/tests/constructors.cpp b/tests/constructors.cpp index fc87a97..1c7a806 100644 --- a/tests/constructors.cpp +++ b/tests/constructors.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include #include struct foo { diff --git a/tests/emplace.cpp b/tests/emplace.cpp index 0a87983..feccd41 100644 --- a/tests/emplace.cpp +++ b/tests/emplace.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include #include #include diff --git a/tests/extensions.cpp b/tests/extensions.cpp index d97687e..a5d6352 100644 --- a/tests/extensions.cpp +++ b/tests/extensions.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include #include #define TOKENPASTE(x, y) x##y diff --git a/tests/hash.cpp b/tests/hash.cpp index 16437da..af0dff3 100644 --- a/tests/hash.cpp +++ b/tests/hash.cpp @@ -1,4 +1,4 @@ #include "catch.hpp" -#include "optional.hpp" +#include TEST_CASE("Hashing", "[hash]") {} diff --git a/tests/in_place.cpp b/tests/in_place.cpp index 07254e4..4fa87be 100644 --- a/tests/in_place.cpp +++ b/tests/in_place.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include #include #include diff --git a/tests/issues.cpp b/tests/issues.cpp index 387b083..d5672a3 100644 --- a/tests/issues.cpp +++ b/tests/issues.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include #include struct foo{ diff --git a/tests/make_optional.cpp b/tests/make_optional.cpp index ba44fd9..779ad52 100644 --- a/tests/make_optional.cpp +++ b/tests/make_optional.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include #include #include diff --git a/tests/noexcept.cpp b/tests/noexcept.cpp index b12fdea..0f5e368 100644 --- a/tests/noexcept.cpp +++ b/tests/noexcept.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include TEST_CASE("Noexcept", "[noexcept]") { tl::optional o1{4}; diff --git a/tests/nullopt.cpp b/tests/nullopt.cpp index 6340724..0ddd17b 100644 --- a/tests/nullopt.cpp +++ b/tests/nullopt.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include TEST_CASE("Nullopt", "[nullopt]") { tl::optional o1 = tl::nullopt; diff --git a/tests/observers.cpp b/tests/observers.cpp index 642b9f6..96db38f 100644 --- a/tests/observers.cpp +++ b/tests/observers.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include struct move_detector { move_detector() = default; diff --git a/tests/relops.cpp b/tests/relops.cpp index 2f388e7..4c06833 100644 --- a/tests/relops.cpp +++ b/tests/relops.cpp @@ -1,5 +1,5 @@ #include "catch.hpp" -#include "optional.hpp" +#include TEST_CASE("Relational ops", "[relops]") { tl::optional o1{4};