I searched a long time for a way of changing CMake's build directory without cding into it.
I eventually find the -H option and make my scripts with it.
Now I typed in cmake --help and I directly have seen following output:
$ cmake --help
Usage
cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
cmake [options] -S <path-to-source> -B <path-to-build>
I recently use:
$ cmake --version
cmake version 3.14.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
and I think in older version this was missing.
Nevertheless, I wonder if there is any difference between -H and -S option. Furthermore I wonder if they are safe to use at all. I found this questions in other posts, but it has not been answered (e.g. here: How to tell CMake where to put build files?)
-H option is not documented and exists long before -S option. It was somewhat considered a "trick" before -S option existed. The -H option purpouse was to make developers life easier, but they left it in release builds, so people started using it. Since cmake 3.13 (I think it's Novemeber 2018) the -S option is available, making -H obsolete (or not? I don't know what the intention of cmake developers is).
Seeing cmake sources the -H and -S option act exactly the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With