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 | 17 | #endif |
| 18 | 18 | #if defined(CPP11_CPP14) && __has_include(<experimental/optional>) |
| 19 | 19 | #include <experimental/optional> |
| 20 | -#ifdef __cpp_lib_experimental_optional | |
| 21 | 20 | #define CLI11_EXPERIMENTAL_OPTIONAL |
| 22 | 21 | #endif |
| 23 | -#endif | |
| 24 | 22 | #if __has_include(<boost/optional>) |
| 25 | 23 | #include <boost/optional.hpp> |
| 26 | 24 | #define CLI11_BOOST_OPTIONAL | ... | ... |
tests/CMakeLists.txt
| ... | ... | @@ -63,3 +63,11 @@ set_property(TARGET informational PROPERTY |
| 63 | 63 | file(WRITE "${PROJECT_BINARY_DIR}/CTestCustom.cmake" |
| 64 | 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 | 21 | #endif |
| 22 | 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 | 31 | #ifdef CLI11_OPTIONAL |
| 25 | 32 | std::cout << " [Available as CLI::optional]"; |
| 26 | 33 | #else |
| 27 | - std::cout << " No optional library found\n"; | |
| 34 | + std::cout | |
| 35 | + << " No optional library found\n"; | |
| 28 | 36 | #endif |
| 29 | 37 | |
| 30 | 38 | #ifdef CLI11_STD_OPTIONAL | ... | ... |