mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00

committed by
Brad King

parent
eaa00d4dfa
commit
5e0c1777a3
@@ -1656,6 +1656,7 @@ syn keyword cmakeVariable contained
|
||||
\ CMAKE_SKIP_INSTALL_RPATH
|
||||
\ CMAKE_SKIP_INSTALL_RULES
|
||||
\ CMAKE_SKIP_RPATH
|
||||
\ CMAKE_SKIP_TEST_ALL_DEPENDENCY
|
||||
\ CMAKE_SOURCE_DIR
|
||||
\ CMAKE_STAGING_PREFIX
|
||||
\ CMAKE_STATIC_LIBRARY_PREFIX
|
||||
|
@@ -255,6 +255,7 @@ Variables that Change Behavior
|
||||
/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES
|
||||
/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName
|
||||
/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
|
||||
/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY
|
||||
/variable/CMAKE_STAGING_PREFIX
|
||||
/variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
|
||||
/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
|
||||
|
6
Help/release/dev/make-test-depend-on-all.rst
Normal file
6
Help/release/dev/make-test-depend-on-all.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
make-test-depend-on-all
|
||||
-----------------------
|
||||
|
||||
* The :variable:`CMAKE_SKIP_TEST_ALL_DEPENDENCY` variable was added
|
||||
to control whether the ``test`` (or ``RUN_TESTS``) buildsystem
|
||||
target depends on the ``all`` (or ``ALL_BUILD``) target.
|
@@ -9,3 +9,5 @@ built, first the ``all`` target is built, then the installation starts.
|
||||
If ``CMAKE_SKIP_INSTALL_ALL_DEPENDENCY`` is set to ``TRUE``, this
|
||||
dependency is not created, so the installation process will start immediately,
|
||||
independent from whether the project has been completely built or not.
|
||||
|
||||
See also :variable:`CMAKE_SKIP_TEST_ALL_DEPENDENCY`.
|
||||
|
19
Help/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY.rst
Normal file
19
Help/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY.rst
Normal file
@@ -0,0 +1,19 @@
|
||||
CMAKE_SKIP_TEST_ALL_DEPENDENCY
|
||||
------------------------------
|
||||
|
||||
.. versionadded:: 3.29
|
||||
|
||||
Control whether the ``test`` target depends on the ``all`` target.
|
||||
|
||||
If this variable is not defined, or is set to ``TRUE``, then the
|
||||
``test`` (or ``RUN_TESTS``) target does not depend on the
|
||||
``all`` (or ``ALL_BUILD``) target. When the ``test`` target is built,
|
||||
e.g., via ``make test``, the test process will start immediately,
|
||||
regardless of whether the project has been completely built or not.
|
||||
|
||||
If ``CMAKE_SKIP_TEST_ALL_DEPENDENCY`` is explicitly set to ``FALSE``,
|
||||
then the ``test`` target will depend on the ``all`` target. When the
|
||||
``test`` target is built, e.g., via ``make test``, the ``all`` target
|
||||
will be built first, and then the tests will run.
|
||||
|
||||
See also :variable:`CMAKE_SKIP_INSTALL_ALL_DEPENDENCY`.
|
@@ -2865,6 +2865,14 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
|
||||
gti.Name = this->GetTestTargetName();
|
||||
gti.Message = "Running tests...";
|
||||
gti.UsesTerminal = true;
|
||||
// Unlike the 'install' target, the 'test' target does not depend on 'all'
|
||||
// by default. Enable it only if CMAKE_SKIP_TEST_ALL_DEPENDENCY is
|
||||
// explicitly set to OFF.
|
||||
if (cmValue noall = mf->GetDefinition("CMAKE_SKIP_TEST_ALL_DEPENDENCY")) {
|
||||
if (cmIsOff(noall)) {
|
||||
gti.Depends.emplace_back(this->GetAllTargetName());
|
||||
}
|
||||
}
|
||||
cmCustomCommandLine singleLine;
|
||||
singleLine.push_back(cmSystemTools::GetCTestCommand());
|
||||
singleLine.push_back("--force-new-ctest-process");
|
||||
|
@@ -15,3 +15,5 @@ function(run_BuiltinTarget case target)
|
||||
endfunction()
|
||||
|
||||
run_BuiltinTarget(TestDependsAll-Default test)
|
||||
run_BuiltinTarget(TestDependsAll-No test)
|
||||
run_BuiltinTarget(TestDependsAll-Yes test)
|
||||
|
2
Tests/RunCMake/BuiltinTargets/TestDependsAll-No.cmake
Normal file
2
Tests/RunCMake/BuiltinTargets/TestDependsAll-No.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(TestDependsAll-common.cmake)
|
||||
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY ON)
|
@@ -0,0 +1,3 @@
|
||||
if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/custom-output.txt)
|
||||
set(RunCMake_TEST_FAILED "Building 'test' target did not build 'all' target:\n ${RunCMake_TEST_BINARY_DIR}/custom-output.txt")
|
||||
endif()
|
2
Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes.cmake
Normal file
2
Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(TestDependsAll-common.cmake)
|
||||
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY OFF)
|
Reference in New Issue
Block a user