Skip to main content
100%

Support CMAKE_CXX_STANDARD in older cmake versions

✓ Published0🌍 Public
CChristosT
Last edited May 3, 2019
Created on May 3, 2019

This example shows how to set the C++ standard in CMake while maintaining compatibility with older versions of the tool. It checks `CMAKE_VERSION` against version 3.1 and, for older versions, appends the `-std=c++11` flag to `CMAKE_CXX_FLAGS`. For newer versions, it uses the more modern `CMAKE_CXX_STANDARD` variable set to 11. The code references a Stack Overflow answer as its source, illustrating a common conditional pattern for cross-version build configuration.

AI-generated description

Similar vizzes