mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-09-02 15:53:52 +00:00
The -std=c++X flag was set in three different places, (1) at the beginning of the CMakeLists.txt with `set(CMAKE_CXX_STANDARD)`, later (2) with `CMAKE_CXX_FLAGS` and finally (3) by the combination cmake's CMP0128=NEW policy, some versions of g++ and the settings of CMAKE_CXX_STANDARD_REQUIRED=ON and CMAKE_CXX_EXTENSIONS=OFF. Because of (1) _or_ (2) the MinGW compiler (and possibly others) would add -std=c++17 to the build arguments _after_ the -std=c++X defined in `CMAKE_CXX_FLAGS` resulting in the c++17 standard being used regardless of what `CMAKE_CXX_FLAGS` has to say. This patch also applies the c++ standard per target to avoid the `CMAKE_CXX_STANDARD` setting leaking into projects which include this i2pd's CMakeLists.txt.