mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Introduce `CMD_STRICT` to act as a parent for warnings about allowed but disrecommended usage. Introduce a warning that discourages use of non-target directives (which modify the build environment for the entire [sub]tree). Add notes to the official documentation recommending use of target-specific alternatives. This has been accepted wisdom for quite some time, but only some of the affected commands made any mention of this in the documentation.
35 lines
1.1 KiB
CMake
35 lines
1.1 KiB
CMake
include(RunCMake)
|
|
|
|
run_cmake(Actions)
|
|
run_cmake(ExistenceCheck)
|
|
|
|
run_cmake_with_options(
|
|
CacheInit
|
|
"-DCMAKE_DIAGNOSTIC_INIT=CMD_AUTHOR=IGNORE\;CMD_DEPRECATED=SEND_ERROR"
|
|
)
|
|
|
|
run_cmake_with_options(CommandLine1 -Wno-author -Werror=author)
|
|
run_cmake_with_options(CommandLine1 -Werror=author)
|
|
run_cmake_with_options(CommandLine1 -Werror=author -Wdeprecated)
|
|
run_cmake_with_options(CommandLine1 -Wno-deprecated -Werror=author)
|
|
run_cmake_with_options(CommandLine2 -Werror=author -Wno-deprecated)
|
|
run_cmake_with_options(CommandLine3 -Wno-error=uninitialized -Winstall-absolute-destination)
|
|
|
|
function(run_persist_test NAME)
|
|
set(RunCMake_TEST_VARIANT_DESCRIPTION "-first")
|
|
run_cmake_with_options(${NAME} ${ARGN})
|
|
set(RunCMake_TEST_NO_CLEAN 1)
|
|
set(RunCMake_TEST_VARIANT_DESCRIPTION "-second")
|
|
run_cmake(${NAME})
|
|
endfunction()
|
|
|
|
block()
|
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Persist-build)
|
|
run_persist_test(Persist1 -Wno-author)
|
|
set(RunCMake_TEST_NO_CLEAN 1)
|
|
run_persist_test(Persist2 -Wauthor)
|
|
endblock()
|
|
|
|
run_cmake_with_options(NonTargetDirectives -Wstrict)
|
|
run_cmake_with_options(NonTargetDirectives -Wnon-target-directive)
|