diff --git a/Help/policy/CMP0007.rst b/Help/policy/CMP0007.rst index b95f36c3a9..7b013db8d6 100644 --- a/Help/policy/CMP0007.rst +++ b/Help/policy/CMP0007.rst @@ -1,6 +1,9 @@ CMP0007 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + list command no longer ignores empty elements. This policy determines whether the list command will ignore empty @@ -11,7 +14,5 @@ elements. The ``NEW`` behavior for this policy is to correctly count empty elements in a list. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0 -.. |WARNS_OR_DOES_NOT_WARN| replace:: warns -.. include:: STANDARD_ADVICE.txt - -.. include:: DEPRECATED.txt +.. |WARNED_OR_DID_NOT_WARN| replace:: warned +.. include:: REMOVED_EPILOGUE.txt diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake index b022217598..8d21155757 100644 --- a/Modules/CMakeIOSInstallCombined.cmake +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -60,9 +60,6 @@ endfunction() # Get architectures of given SDK (iphonesimulator/iphoneos) function(_ios_install_combined_get_valid_archs sdk resultvar) - cmake_policy(PUSH) - cmake_policy(SET CMP0007 NEW) - if("${resultvar}" STREQUAL "") message(FATAL_ERROR "`resultvar` is empty") endif() @@ -77,8 +74,6 @@ function(_ios_install_combined_get_valid_archs sdk resultvar) _ios_install_combined_message("Architectures (${sdk}): ${printable}") set("${resultvar}" "${valid_archs}" PARENT_SCOPE) - - cmake_policy(POP) endfunction() # Make both arch lists a disjoint set by preferring the current SDK diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index 17e12f8cf7..32c5268c6f 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -50,8 +50,6 @@ # generated_cubin_file:STRING=<> File to generate. This argument must be passed # in if build_cubin is true. -cmake_policy(PUSH) -cmake_policy(SET CMP0007 NEW) if(NOT generated_file) message(FATAL_ERROR "You must specify generated_file on the command line") endif() @@ -302,5 +300,3 @@ if( build_cubin ) ) endif() - -cmake_policy(POP) diff --git a/Modules/FindEnvModules.cmake b/Modules/FindEnvModules.cmake index 5337e4fdc6..9149af3229 100644 --- a/Modules/FindEnvModules.cmake +++ b/Modules/FindEnvModules.cmake @@ -268,7 +268,6 @@ endfunction() #------------------------------------------------------------------------------ function(env_module_list out_var) - cmake_policy(SET CMP0007 NEW) env_module(COMMAND -t list OUTPUT_VARIABLE tmp_out) # Convert output into a CMake list @@ -286,8 +285,6 @@ endfunction() #------------------------------------------------------------------------------ function(env_module_avail) - cmake_policy(SET CMP0007 NEW) - if(ARGC EQUAL 1) set(mod_prefix) set(out_var ${ARGV0}) diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 7bfdd88b57..9cc8703a98 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -10,8 +10,6 @@ # cmake_policy(PUSH) -# list supports empty elements -cmake_policy (SET CMP0007 NEW) # numbers and boolean constants cmake_policy (SET CMP0012 NEW) # IN_LIST operator diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index 81481a7ba7..3b0e13bf07 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -195,9 +195,6 @@ if(FortranCInterface_SOURCE_DIR) return() endif() -cmake_policy(PUSH) -cmake_policy(SET CMP0007 NEW) - #----------------------------------------------------------------------------- # Verify that C and Fortran are available. foreach(lang C Fortran) @@ -402,6 +399,3 @@ function(FortranCInterface_VERIFY) "The output was:\n ${_output}") endif() endfunction() - -# Restore including context policies. -cmake_policy(POP) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 67c6032376..71434716ff 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -89,29 +89,6 @@ cm::optional GetList(const std::string& var, if (!cm::contains(*list, std::string())) { return list; } - // if we have empty elements we need to check policy CMP0007 - switch (makefile.GetPolicyStatus(cmPolicies::CMP0007)) { - case cmPolicies::WARN: { - // Default is to warn and use old behavior - // OLD behavior is to allow compatibility, so recall - // ExpandListArgument without the true which will remove - // empty values - list->assign(listString); - std::string warn = - cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0007), - " List has value = [", listString, "]."); - makefile.IssueMessage(MessageType::AUTHOR_WARNING, warn); - return list; - } - case cmPolicies::OLD: - // OLD behavior is to allow compatibility, so recall - // ExpandListArgument without the true which will remove - // empty values - list->assign(listString); - return list; - case cmPolicies::NEW: - return list; - } return list; } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 4f27622c26..0928f7c07c 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -35,7 +35,7 @@ class cmMakefile; "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \ 2, 6, 0, NEW) \ SELECT(POLICY, CMP0007, "list command no longer ignores empty elements.", \ - 2, 6, 0, WARN) \ + 2, 6, 0, NEW) \ SELECT( \ POLICY, CMP0008, \ "Libraries linked by full-path must have a valid library file name.", 2, \ diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 0120c84707..118be6c32d 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -152,33 +152,10 @@ foreach(cmd IN ITEMS Find Get Insert Length Remove_At) check_cmake_test_single(List "${cmd}-List-Only" "${_test_file_name}") endforeach() -set(thelist "" NEW OLD) - -foreach (_pol ${thelist}) - cmake_policy(SET CMP0007 ${_pol}) - list(GET thelist 1 thevalue) - if (NOT thevalue STREQUAL _pol) - message(SEND_ERROR "returned element '${thevalue}', but expected '${_pol}'") - endif() -endforeach (_pol) - -block(SCOPE_FOR POLICIES) - cmake_policy(SET CMP0007 NEW) - set(result andy bill brad ken bob) - list(INSERT result 1 "") - TEST("INSERT result 1 \"\"" "andy;;bill;brad;ken;bob") - list(INSERT result 4 ";") - TEST("INSERT result 1 ;" "andy;;bill;brad;;;ken;bob") - list(INSERT result 0 "x") - TEST("INSERT result 1 x" "x;andy;;bill;brad;;;ken;bob") -endblock() -block(SCOPE_FOR POLICIES) - cmake_policy(SET CMP0007 OLD) - set(result andy bill brad ken bob) - list(INSERT result 1 "") - TEST("INSERT result 1 \"\"" "andy;;bill;brad;ken;bob") - list(INSERT result 4 ";") - TEST("INSERT result 1 ;" "andy;bill;brad;ken;;;bob") - list(INSERT result 0 "x") - TEST("INSERT result 1 x" "x;andy;bill;brad;ken;bob") -endblock() +set(result andy bill brad ken bob) +list(INSERT result 1 "") +TEST("INSERT result 1 \"\"" "andy;;bill;brad;ken;bob") +list(INSERT result 4 ";") +TEST("INSERT result 1 ;" "andy;;bill;brad;;;ken;bob") +list(INSERT result 0 "x") +TEST("INSERT result 1 x" "x;andy;;bill;brad;;;ken;bob") diff --git a/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in index 48add615ef..697e055a07 100644 --- a/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in +++ b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in @@ -46,52 +46,23 @@ if (NOT output STREQUAL listvar) list (APPEND errors "returns bad value: ${output}") endif() -block(SCOPE_FOR POLICIES) - cmake_policy(SET CMP0007 NEW) +set(listvar "0;1;2;3;4") +list(INSERT listvar 1 "") +set (output "$") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() - set(listvar "0;1;2;3;4") - list(INSERT listvar 1 "") - set (output "$") - if (NOT output STREQUAL listvar) - list (APPEND errors "returns bad value: ${output}") - endif() +list(INSERT listvar 4 ";") +set (output "$") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() - list(INSERT listvar 4 ";") - set (output "$") - if (NOT output STREQUAL listvar) - list (APPEND errors "returns bad value: ${output}") - endif() - - list(INSERT listvar 0 "x") - set (output "$") - if (NOT output STREQUAL listvar) - list (APPEND errors "returns bad value: ${output}") - endif() -endblock() -block(SCOPE_FOR POLICIES) - set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "") - cmake_policy(SET CMP0007 OLD) - - set(listvar "0;1;2;3;4") - list(INSERT listvar 1 "") - set (output "$") - if (NOT output STREQUAL listvar) - list (APPEND errors "returns bad value: ${output}") - endif() - - list(INSERT listvar 4 ";") - set (output "$") - if (NOT output STREQUAL listvar) - list (APPEND errors "returns bad value: ${output}") - endif() - - list(INSERT listvar 0 "x") - set (output "$") - if (NOT output STREQUAL listvar) - list (APPEND errors "returns bad value: ${output}") - endif() - - unset(CMAKE_WARN_DEPRECATED CACHE) -endblock() +list(INSERT listvar 0 "x") +set (output "$") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() check_errors("LIST:INSERT..." ${errors}) diff --git a/Tests/RunCMake/function/CMAKE_CURRENT_FUNCTION.cmake b/Tests/RunCMake/function/CMAKE_CURRENT_FUNCTION.cmake index 38c032ffdb..f6a8e7043d 100644 --- a/Tests/RunCMake/function/CMAKE_CURRENT_FUNCTION.cmake +++ b/Tests/RunCMake/function/CMAKE_CURRENT_FUNCTION.cmake @@ -80,8 +80,6 @@ endfunction() calling_macro() -cmake_policy(SET CMP0007 NEW) - # ATTENTION `CMAKE_CURRENT_LIST_LINE` can't be used in `math()' function(print_self) file(STRINGS "${CMAKE_CURRENT_FUNCTION_LIST_FILE}" _lines) diff --git a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt deleted file mode 100644 index 4f376d8e83..0000000000 --- a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt +++ /dev/null @@ -1,18 +0,0 @@ -^CMake Deprecation Warning at GET-CMP0007-WARN\.cmake:1 \(cmake_policy\): - Compatibility with CMake < 3\.10 will be removed from a future version of - CMake\. - - Update the VERSION argument value\. Or, use the \.\.\. syntax - to tell CMake that the project requires at least but has been updated - to work with policies introduced by or earlier\. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Warning \(dev\) at GET-CMP0007-WARN\.cmake:4 \(list\): - Policy CMP0007 is not set: list command no longer ignores empty elements. - Run "cmake --help-policy CMP0007" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. List has value = - \[;NEW;OLD\]. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/list/GET-CMP0007-WARN.cmake b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake deleted file mode 100644 index 833f352048..0000000000 --- a/Tests/RunCMake/list/GET-CMP0007-WARN.cmake +++ /dev/null @@ -1,7 +0,0 @@ -cmake_policy(VERSION 2.4) -set(thelist "" NEW OLD) - -list(GET thelist 1 thevalue) -if (NOT thevalue STREQUAL "OLD") - message(SEND_ERROR "returned element '${thevalue}', but expected 'OLD'") -endif() diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index adfe2554cc..1b67635e89 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -7,7 +7,6 @@ run_cmake(EmptyInsert-1) run_cmake(NoArguments) run_cmake(InvalidSubcommand) -run_cmake(GET-CMP0007-WARN) run_cmake(FILTER-REGEX-InvalidRegex) run_cmake(GET-InvalidIndex)