Skip to content

Commit 6ce8555

Browse files
committed
Do CMake properly
1 parent 53697d4 commit 6ce8555

20 files changed

+32
-21
lines changed

.appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ os:
33
- Visual Studio 2017
44

55
build_script:
6+
- git submodule update --init --recursive
67
- mkdir build
78
- cd build
89
- cmake ..

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "cmake/tl-cmake"]
2+
path = cmake/tl-cmake
3+
url = https://github.com/TartanLlama/tl-cmake.git

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
cmake_minimum_required(VERSION 3.0)
1+
cmake_minimum_required(VERSION 3.8)
22

3-
project(optional)
3+
project(tl-optional VERSION 1.0.0 LANGUAGES CXX)
44

55
option(OPTIONAL_ENABLE_TESTS "Enable tests." ON)
66

7-
add_library(optional INTERFACE)
8-
target_sources(optional INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/tl/optional.hpp)
9-
target_include_directories(optional INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/tl)
7+
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/tl-cmake" ${CMAKE_MODULE_PATH})
8+
include(add-tl)
9+
10+
tl_add_library(optional SOURCES
11+
include/tl/optional.hpp)
1012

1113
if(OPTIONAL_ENABLE_TESTS)
1214
# Prepare "Catch" library for other executables

cmake/tl-cmake

Submodule tl-cmake added at 576e25f

cmake/tl-optional-config.cmake.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@PACKAGE_INIT@
2+
3+
include("${CMAKE_CURRENT_LIST_DIR}/tl-optional-targets.cmake")

tl/optional.hpp renamed to include/tl/optional.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
#ifndef TL_OPTIONAL_HPP
1616
#define TL_OPTIONAL_HPP
1717

18-
#define TL_OPTIONAL_VERSION_MAJOR 0
19-
#define TL_OPTIONAL_VERSION_MINOR 5
18+
#define TL_OPTIONAL_VERSION_MAJOR 1
19+
#define TL_OPTIONAL_VERSION_MINOR 0
20+
#define TL_OPTIONAL_VERSION_PATCH 0
2021

2122
#include <exception>
2223
#include <functional>

tests/assignment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "catch.hpp"
2-
#include "optional.hpp"
2+
#include <tl/optional.hpp>
33

44
TEST_CASE("Assignment value", "[assignment.value]") {
55
tl::optional<int> o1 = 42;

tests/bases.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "catch.hpp"
2-
#include "optional.hpp"
2+
#include <tl/optional.hpp>
33

44
// Old versions of GCC don't have the correct trait names. Could fix them up if needs be.
55
#if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \

tests/constexpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "catch.hpp"
2-
#include "optional.hpp"
2+
#include <tl/optional.hpp>
33

44
#define TOKENPASTE(x, y) x##y
55
#define TOKENPASTE2(x, y) TOKENPASTE(x, y)

tests/constructors.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "catch.hpp"
2-
#include "optional.hpp"
2+
#include <tl/optional.hpp>
33
#include <vector>
44

55
struct foo {

0 commit comments

Comments
 (0)