Modern CMake
Shown to me by Kajanan.
There are so many things to understand
C++ Flags
- Disable Compiler Extensions:
set(CMAKE_CXX_EXTENSIONS OFF)
instructs CMake to use the standard-compliant version of the C++ language without any compiler-specific extensions. It promotes portability of your code across different compilers.
https://cliutils.gitlab.io/modern-cmake/
Instead of this,
You can replace the make line with cmake --build .
 if you’d like, and it will call make
 or whatever build tool you are using. If you are using a newer version of CMake (which you usually should be, except for checking compatibility with older CMake), you can instead do this:
I don't like this
It’s essentially specifying that all of the build is inside the
build
folder, but you don’t have tocd
into it.