Commit accbf41d authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'short-commands'

077ab577 cmake: add short version of '--target <tgt>...' option
071f5e15

 cmake: Reformat '--parallel' and '--verbose' options in help
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !3078
parents 46ad0f7e 077ab577
Pipeline #132196 failed with stage
in 0 seconds
......@@ -269,14 +269,14 @@ following options:
``--build <dir>``
Project binary directory to be built. This is required and must be first.
``-j [<jobs>], --parallel [<jobs>]``
``--parallel [<jobs>], -j [<jobs>]``
The maximum number of concurrent processes to use when building.
If ``<jobs>`` is omitted the native build tool's default number is used.
The :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment variable, if set,
specifies a default parallel level when this option is not given.
``--target <tgt>...``
``--target <tgt>..., -t <tgt>...``
Build ``<tgt>`` instead of default targets. May be specified multiple times.
``--config <cfg>``
......@@ -289,7 +289,7 @@ following options:
``--use-stderr``
Ignored. Behavior is default in CMake >= 3.0.
``-v, --verbose``
``--verbose, -v``
Enable verbose output - if supported - including the build commands to be
executed.
......
cmake-short-target-option
----------------------------
* The :manual:`cmake(1)` ``--target`` parameter gained shorter
version ``-t``, e.g. ``cmake --build . -t Library1 Library2`` is
equivalant to ``cmake --build . --target Library1 Library2``.
......@@ -54,20 +54,21 @@ static const char* cmDocumentationUsageNote[][2] = {
# define CMAKE_BUILD_OPTIONS \
" <dir> = Project binary directory to be built.\n" \
" -j [<jobs>] --parallel [<jobs>] = Build in parallel using\n" \
" the given number of jobs. If <jobs> is omitted\n" \
" the native build tool's default number is used.\n" \
" --parallel [<jobs>], -j [<jobs>]\n" \
" = Build in parallel using the given number of jobs. \n" \
" If <jobs> is omitted the native build tool's \n" \
" default number is used.\n" \
" The CMAKE_BUILD_PARALLEL_LEVEL environment " \
"variable\n" \
" specifies a default parallel level when this " \
"option\n" \
" is not given.\n" \
" --target <tgt> = Build <tgt> instead of default targets.\n" \
" May be specified multiple times.\n" \
" --target <tgt>..., -t <tgt>... \n" \
" = Build <tgt> instead of default targets.\n" \
" --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \
" --clean-first = Build target 'clean' first, then build.\n" \
" (To clean only, use --target 'clean'.)\n" \
" -v --verbose = Enable verbose output - if supported - including\n" \
" --verbose, -v = Enable verbose output - if supported - including\n" \
" the build commands to be executed. \n" \
" -- = Pass remaining options to the native tool.\n"
......@@ -429,7 +430,8 @@ static int do_build(int ac, char const* const* av)
dir.clear();
}
doing = DoingNone;
} else if (strcmp(av[i], "--target") == 0) {
} else if ((strcmp(av[i], "--target") == 0) ||
(strcmp(av[i], "-t") == 0)) {
doing = DoingTarget;
} else if (strcmp(av[i], "--config") == 0) {
doing = DoingConfig;
......
......@@ -106,7 +106,7 @@ function(run_BuildDir)
run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget)
run_cmake_command(BuildDir--build-multiple-targets ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget2 --target CustomTarget3)
${CMAKE_COMMAND} --build BuildDir-build -t CustomTarget2 --target CustomTarget3)
run_cmake_command(BuildDir--build-multiple-targets-jobs ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget CustomTarget2 -j2 --target CustomTarget3)
run_cmake_command(BuildDir--build-multiple-targets-with-clean-first ${CMAKE_COMMAND} -E chdir ..
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment