diff --git a/include/CLI/Optional.hpp b/include/CLI/Optional.hpp index 160f264..9e1315e 100644 --- a/include/CLI/Optional.hpp +++ b/include/CLI/Optional.hpp @@ -17,10 +17,8 @@ #endif #if defined(CPP11_CPP14) && __has_include() #include -#ifdef __cpp_lib_experimental_optional #define CLI11_EXPERIMENTAL_OPTIONAL #endif -#endif #if __has_include() #include #define CLI11_BOOST_OPTIONAL diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 36acc9a..2fc47a6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -63,3 +63,11 @@ set_property(TARGET informational PROPERTY file(WRITE "${PROJECT_BINARY_DIR}/CTestCustom.cmake" "set(CTEST_CUSTOM_PRE_TEST \"${CMAKE_BINARY_DIR}/informational\")" ) + +# Add boost to test boost::optional if available +find_package(Boost 1.35) +if(Boost_FOUND) + target_link_libraries(informational PUBLIC Boost::boost) + target_link_libraries(OptionalTest PUBLIC Boost::boost) +endif() + diff --git a/tests/informational.cpp b/tests/informational.cpp index ef9448a..5c219ba 100644 --- a/tests/informational.cpp +++ b/tests/informational.cpp @@ -21,10 +21,18 @@ int main() { #endif std::cout << "\n"; + std::cout << " __has_include: "; +#ifdef __has_include + std::cout << "yes\n"; +#else + std::cout << "no\n"; +#endif + #ifdef CLI11_OPTIONAL std::cout << " [Available as CLI::optional]"; #else - std::cout << " No optional library found\n"; + std::cout + << " No optional library found\n"; #endif #ifdef CLI11_STD_OPTIONAL