Commit 17437921c0f6d073935371b210876758a2dce88e
Committed by
Henry Schreiner
1 parent
39e77739
Adding more informational printouts
Showing
3 changed files
with
17 additions
and
3 deletions
include/CLI/Optional.hpp
| @@ -17,10 +17,8 @@ | @@ -17,10 +17,8 @@ | ||
| 17 | #endif | 17 | #endif |
| 18 | #if defined(CPP11_CPP14) && __has_include(<experimental/optional>) | 18 | #if defined(CPP11_CPP14) && __has_include(<experimental/optional>) |
| 19 | #include <experimental/optional> | 19 | #include <experimental/optional> |
| 20 | -#ifdef __cpp_lib_experimental_optional | ||
| 21 | #define CLI11_EXPERIMENTAL_OPTIONAL | 20 | #define CLI11_EXPERIMENTAL_OPTIONAL |
| 22 | #endif | 21 | #endif |
| 23 | -#endif | ||
| 24 | #if __has_include(<boost/optional>) | 22 | #if __has_include(<boost/optional>) |
| 25 | #include <boost/optional.hpp> | 23 | #include <boost/optional.hpp> |
| 26 | #define CLI11_BOOST_OPTIONAL | 24 | #define CLI11_BOOST_OPTIONAL |
tests/CMakeLists.txt
| @@ -63,3 +63,11 @@ set_property(TARGET informational PROPERTY | @@ -63,3 +63,11 @@ set_property(TARGET informational PROPERTY | ||
| 63 | file(WRITE "${PROJECT_BINARY_DIR}/CTestCustom.cmake" | 63 | file(WRITE "${PROJECT_BINARY_DIR}/CTestCustom.cmake" |
| 64 | "set(CTEST_CUSTOM_PRE_TEST \"${CMAKE_BINARY_DIR}/informational\")" | 64 | "set(CTEST_CUSTOM_PRE_TEST \"${CMAKE_BINARY_DIR}/informational\")" |
| 65 | ) | 65 | ) |
| 66 | + | ||
| 67 | +# Add boost to test boost::optional if available | ||
| 68 | +find_package(Boost 1.35) | ||
| 69 | +if(Boost_FOUND) | ||
| 70 | + target_link_libraries(informational PUBLIC Boost::boost) | ||
| 71 | + target_link_libraries(OptionalTest PUBLIC Boost::boost) | ||
| 72 | +endif() | ||
| 73 | + |
tests/informational.cpp
| @@ -21,10 +21,18 @@ int main() { | @@ -21,10 +21,18 @@ int main() { | ||
| 21 | #endif | 21 | #endif |
| 22 | std::cout << "\n"; | 22 | std::cout << "\n"; |
| 23 | 23 | ||
| 24 | + std::cout << " __has_include: "; | ||
| 25 | +#ifdef __has_include | ||
| 26 | + std::cout << "yes\n"; | ||
| 27 | +#else | ||
| 28 | + std::cout << "no\n"; | ||
| 29 | +#endif | ||
| 30 | + | ||
| 24 | #ifdef CLI11_OPTIONAL | 31 | #ifdef CLI11_OPTIONAL |
| 25 | std::cout << " [Available as CLI::optional]"; | 32 | std::cout << " [Available as CLI::optional]"; |
| 26 | #else | 33 | #else |
| 27 | - std::cout << " No optional library found\n"; | 34 | + std::cout |
| 35 | + << " No optional library found\n"; | ||
| 28 | #endif | 36 | #endif |
| 29 | 37 | ||
| 30 | #ifdef CLI11_STD_OPTIONAL | 38 | #ifdef CLI11_STD_OPTIONAL |