-
Notifications
You must be signed in to change notification settings - Fork 186
Description
Hi there! I encountered a problem introduced by toml11's CMakeLists which wasn't easy to figure out.
I tried to configure a project which uses toml11 and Microsoft.GSL libraries and was getting the error GSL: Requires at least CXX standard 14, user provided 11 from the GSL CMake config which was produced by the following code
if (${CMAKE_CXX_STANDARD} VERSION_LESS ${min_cxx_standard})
message(FATAL_ERROR "GSL: Requires at least CXX standard ${min_cxx_standard}, user provided ${CMAKE_CXX_STANDARD}")
endif()
In my projects I use target_compile_features to set the required C++ standard, so the variable CMAKE_CXX_STANDARD is left undefined, so I was puzzled until I find out that toml11 CMake sets this variable to 11 standard unconditionally.
Please consider to check this variable and give an error if it's less than 11 standard instead of setting it by yourself.
Also there's somewhat popular CMake guidelines that agrees that this variable should only be set by the end user of the library.