Installation¶
vary targets C++20 and builds with clang >= 14 or gcc >= 11. It depends only on the base polycpp library (and none).
CMake FetchContent (recommended)¶
Add the library to your CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
polycpp_vary
GIT_REPOSITORY https://github.com/polycpp/vary.git
GIT_TAG master
)
FetchContent_MakeAvailable(polycpp_vary)
add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE polycpp::vary)
The first configure pulls polycpp transitively, so the build tree may be
large. Pin GIT_TAG to a specific commit for reproducible builds.
Using a local clone¶
If you already have vary and polycpp checked out side by side, tell CMake to use them instead of fetching from GitHub:
# Building this repo directly
cmake -B build -G Ninja \
-DPOLYCPP_SOURCE_DIR=/path/to/polycpp
# Consuming this repo through FetchContent
cmake -B build -G Ninja \
-DFETCHCONTENT_SOURCE_DIR_POLYCPP=/path/to/polycpp \
-DFETCHCONTENT_SOURCE_DIR_POLYCPP_VARY=/path/to/vary
This is the path local validation can use when testing a port beside a
polycpp checkout - see tests/ in the repo. The generated CMake also uses
/data/repo/polycpp automatically when that checkout exists.
Build options¶
POLYCPP_VARY_BUILD_TESTSBuild the GoogleTest suite. Defaults to
ONfor standalone builds andOFFwhen consumed via FetchContent.POLYCPP_IOasio(default) orlibuv- inherited from polycpp.POLYCPP_SSL_BACKENDboringssl(default) oropenssl.POLYCPP_UNICODEicu(recommended) orbuiltin. ICU enables the Intl surface that several polycpp headers pull into their public signatures.
Verifying the install¶
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build
ctest --test-dir build --output-on-failure
All tests should pass on a supported toolchain - if they do not, open an issue on the repository with the compiler version and the failing test name.