Skip to content

Commit

Permalink
Fix Boost CMake (#226)
Browse files Browse the repository at this point in the history
* Fixing typos in FindBoost

* Minimum required Boost is actually 1.61
  • Loading branch information
henryiii authored Feb 19, 2019
1 parent c912381 commit 5e0bb1c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
* Custom vector separator [#209], [#221]
* 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:
>
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
# 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).
if(${CMAKE_VERSION} VERSION_LESS 3.12)
if(${CMAKE_VERSION} VERSION_LESS 3.13)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.12)
cmake_policy(VERSION 3.13)
endif()

set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
Expand Down
2 changes: 1 addition & 1 deletion include/CLI/Optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#if __has_include(<boost/optional.hpp>) && !defined(CLI11_BOOST_OPTIONAL)
#include <boost/version.hpp>
#if BOOST_VERSION >= 105800
#if BOOST_VERSION >= 106100
#define CLI11_BOOST_OPTIONAL 1
#endif
#elif !defined(CLI11_BOOST_OPTIONAL)
Expand Down
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ file(WRITE "${PROJECT_BINARY_DIR}/CTestCustom.cmake"
)

# Add boost to test boost::optional if available
find_package(Boost 1.58)
find_package(Boost 1.61)
if(Boost_FOUND)
if (TARGET Boost::boost)
if(TARGET Boost::boost)
target_link_libraries(informational PUBLIC Boost::boost)
target_link_libraries(OptionalTest PUBLIC Boost::boost)
else()
target_link_libraries(informational PUBLIC ${Boost_INCLUDE_DIR})
target_link_libraries(OptionalTest PUBLIC ${BOOST_INCLUDE_DIR})
target_include_directories(informational PUBLIC ${Boost_INCLUDE_DIRS})
target_include_directories(OptionalTest PUBLIC ${Boost_INCLUDE_DIRS})
endif()
# Enforce Boost::Optional even if __has_include is missing on your compiler
target_compile_definitions(informational PUBLIC CLI11_BOOST_OPTIONAL)
Expand Down

0 comments on commit 5e0bb1c

Please sign in to comment.