Closed ghost closed 1 year ago
Actually I'm used to CMAKE_CXX_STANDARD and CMAKE_CXX_STANDARD_REQUIRED in other of my libraries (clip) but I'm not sure why I used target_compile_features() here.
Anyway removing the usage of the old register
keyword fixed some issues related to this.
target_compile_features(vaca PUBLIC cxx_std_14)
will no longer work as you expected. When you wrote this line C++14 was the latest, but now it's C++17 or even C++20. For example, the GCC 12.2.0 compiler of MSYS2 MINGW64 targets C++17 by default. Since C++17 is greater than C++14 andcxx_std_14
means at least C++14 so-std=c++14
will not be added and it will default to C++17. There will be warning about theregister
keyword is not allowed on C++17.https://cmake.org/cmake/help/latest/command/target_compile_features.html
The solution as the document said is explicitly forcing C++14 with:
The
target_compile_features
line could be removed.