I have some options in my CMakeLists.txt file that can be selected with -D on the command line, like this:
# Set some options the user may choose
OPTION(USE_MPI "Use the MPI library for parallelization" OFF)
OPTION(USE_OPENMP "Use OpenMP for parallelization" OFF)
OPTION(TESTING "Enable testing of both Fortran and Python code" OFF)
OPTION(PYTHON_TOOLS "Build the python helper tools" OFF)
OPTION(BUILD_DOCS "Build the documentation; turns on PYTHON_TOOLS" OFF)
and I can activate one of them with something like
$ cmake . -DUSE_MPI=ON
Sometimes I forget what the options I have chosen are. It would be nice if there was some sort of -h flag I could use to display those on the command line in an automated way (in the style of python's argparse).
Is there an automated way to generate help documentation for a particular CMakeLists.txt, and/or call that help with some sort of -h or --help flag? I'm looking for something that will give me this behavior:
$ cmake . --help
USE_MPI - Use the MPI library for parallelization (Default: OFF)
USE_OPENMP - Use OpenMP for parallelization (Default: OFF)
TESTING - Enable testing of both Fortran and Python code (Default: OFF)
PYTHON_TOOLS - Build the python helper tools (Default: OFF)
BUILD_DOCS - Build the documentation; turns on PYTHON_TOOLS (Default: OFF)
If there is no automated way, is there at least an easy way to pass --help or -h to CMakeLists.txt so that I can manually write a help message?