These portable CMake commands build, test and install a project with a modern CMake buildsystem.
cmake -S <path-to-source> -B <path-to-build> # Generate the project's buildsystem in `<path-to-build>`.
cmake --build <path-to-build> # Build the project from the generated buildsystem.
cmake -E chdir <path-to-build> ctest # Test the built project.
cmake --install <path-to-build> # Install the built project.
- Before CMake 3.15, the last command has to be replaced with
cmake --build <path-to-build> --target install
. - Before CMake 3.13, the first command has to be replaced with:
cmake -E make_directory <path-to-build> cmake -E chdir <path-to-build> cmake <path-to-source>