1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 20:23:55 +00:00

Fix Boost CMake (#226)

* Fixing typos in FindBoost

* Minimum required Boost is actually 1.61
This commit is contained in:
Henry Schreiner 2019-02-19 14:08:36 +01:00 committed by GitHub
parent c9123811d1
commit 5e0bb1c8da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -8,6 +8,7 @@ Set handling has been completely replaced by a new backend that works as a Valid
* Support for composable unnamed subcommands [#216] * Support for composable unnamed subcommands [#216]
* Custom vector separator [#209], [#221] * Custom vector separator [#209], [#221]
* Validators added for IP4 addresses and positive numbers [#210] * Validators added for IP4 addresses and positive numbers [#210]
* Minimum required Boost for optional Optionals has been corrected to 1.61
> ### Converting from CLI11 1.7: > ### Converting from CLI11 1.7:
> >

View File

@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 3.4)
# Note: this is a header only library. If you have an older CMake than 3.4, # Note: this is a header only library. If you have an older CMake than 3.4,
# just add the CLI11/include directory and that's all you need to do. # just add the CLI11/include directory and that's all you need to do.
# Make sure users don't get warnings on a tested (3.4 to 3.12) version # Make sure users don't get warnings on a tested (3.4 to 3.13) version
# of CMake. For most of the policies, the new version is better (hence the change). # of CMake. For most of the policies, the new version is better (hence the change).
if(${CMAKE_VERSION} VERSION_LESS 3.12) if(${CMAKE_VERSION} VERSION_LESS 3.13)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else() else()
cmake_policy(VERSION 3.12) cmake_policy(VERSION 3.13)
endif() endif()
set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"") set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")

View File

@ -29,7 +29,7 @@
#if __has_include(<boost/optional.hpp>) && !defined(CLI11_BOOST_OPTIONAL) #if __has_include(<boost/optional.hpp>) && !defined(CLI11_BOOST_OPTIONAL)
#include <boost/version.hpp> #include <boost/version.hpp>
#if BOOST_VERSION >= 105800 #if BOOST_VERSION >= 106100
#define CLI11_BOOST_OPTIONAL 1 #define CLI11_BOOST_OPTIONAL 1
#endif #endif
#elif !defined(CLI11_BOOST_OPTIONAL) #elif !defined(CLI11_BOOST_OPTIONAL)

View File

@ -110,14 +110,14 @@ file(WRITE "${PROJECT_BINARY_DIR}/CTestCustom.cmake"
) )
# Add boost to test boost::optional if available # Add boost to test boost::optional if available
find_package(Boost 1.58) find_package(Boost 1.61)
if(Boost_FOUND) if(Boost_FOUND)
if (TARGET Boost::boost) if(TARGET Boost::boost)
target_link_libraries(informational PUBLIC Boost::boost) target_link_libraries(informational PUBLIC Boost::boost)
target_link_libraries(OptionalTest PUBLIC Boost::boost) target_link_libraries(OptionalTest PUBLIC Boost::boost)
else() else()
target_link_libraries(informational PUBLIC ${Boost_INCLUDE_DIR}) target_include_directories(informational PUBLIC ${Boost_INCLUDE_DIRS})
target_link_libraries(OptionalTest PUBLIC ${BOOST_INCLUDE_DIR}) target_include_directories(OptionalTest PUBLIC ${Boost_INCLUDE_DIRS})
endif() endif()
# Enforce Boost::Optional even if __has_include is missing on your compiler # Enforce Boost::Optional even if __has_include is missing on your compiler
target_compile_definitions(informational PUBLIC CLI11_BOOST_OPTIONAL) target_compile_definitions(informational PUBLIC CLI11_BOOST_OPTIONAL)