Do CMake properly

This commit is contained in:
Simon Brand
2019-05-01 13:23:30 +01:00
parent 53697d4a36
commit 6ce85550f3
20 changed files with 32 additions and 21 deletions

View File

@ -3,6 +3,7 @@ os:
- Visual Studio 2017
build_script:
- git submodule update --init --recursive
- mkdir build
- cd build
- cmake ..

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "cmake/tl-cmake"]
path = cmake/tl-cmake
url = https://github.com/TartanLlama/tl-cmake.git

View File

@ -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

1
cmake/tl-cmake Submodule

Submodule cmake/tl-cmake added at 576e25feab

View File

@ -0,0 +1,3 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/tl-optional-targets.cmake")

View File

@ -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 <exception>
#include <functional>

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
TEST_CASE("Assignment value", "[assignment.value]") {
tl::optional<int> o1 = 42;

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
// 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 && \

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
#define TOKENPASTE(x, y) x##y
#define TOKENPASTE2(x, y) TOKENPASTE(x, y)

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
#include <vector>
struct foo {

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
#include <utility>
#include <tuple>

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
#include <string>
#define TOKENPASTE(x, y) x##y

View File

@ -1,4 +1,4 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
TEST_CASE("Hashing", "[hash]") {}

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
#include <tuple>
#include <vector>

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
#include <type_traits>
struct foo{

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
#include <tuple>
#include <vector>

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
TEST_CASE("Noexcept", "[noexcept]") {
tl::optional<int> o1{4};

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
TEST_CASE("Nullopt", "[nullopt]") {
tl::optional<int> o1 = tl::nullopt;

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
struct move_detector {
move_detector() = default;

View File

@ -1,5 +1,5 @@
#include "catch.hpp"
#include "optional.hpp"
#include <tl/optional.hpp>
TEST_CASE("Relational ops", "[relops]") {
tl::optional<int> o1{4};