Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tl_expected/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ project(tl_expected

find_package(ament_cmake REQUIRED)

option(USE_VENDORED_TL_EXPECTED "Use vendored tl_expected instead of system libexpected-dev" OFF)

add_library(tl_expected INTERFACE)

if(USE_VENDORED_TL_EXPECTED)
target_compile_definitions(tl_expected INTERFACE USE_VENDORED_TL_EXPECTED)
endif()
target_include_directories(tl_expected INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
Expand Down
11 changes: 10 additions & 1 deletion tl_expected/include/tl_expected/expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
// <http://creativecommons.org/publicdomain/zero/1.0/>.
///

// If the system header is available and vendored version is not explicitly
// requested, redirect to the system header with a deprecation warning.
#if !defined(USE_VENDORED_TL_EXPECTED) && __has_include(<tl/expected.hpp>)
#warning("tl_expected/expected.hpp is deprecated, use tl/expected.hpp instead")
#include <tl/expected.hpp>
#else

#ifndef TL_EXPECTED_HPP
#define TL_EXPECTED_HPP

Expand Down Expand Up @@ -2480,4 +2487,6 @@ void swap(expected<T, E> &lhs,
}
} // namespace tl

#endif
#endif // TL_EXPECTED_HPP

#endif // !defined(USE_VENDORED_TL_EXPECTED) && __has_include(<tl/expected.hpp>)
2 changes: 2 additions & 0 deletions tl_expected/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<build_export_depend>libexpected-dev</build_export_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down