From 4edc0ef359578ddaa7db0163e3a6097e12530c9b Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 15 May 2019 12:36:27 +0200 Subject: Test: Improve WarnUnusedCliUnused to run on all generators In the WarnUnusedCliUnused test, the whole CMakeCache.txt was removed in the clean stage to trigger the same CMake warning in re-builds. This technique worked only in the Makefile generators and the test was limited to these. Now only the variable of interest is removed from the cache by using a `unset(UNUSED_CLI_VARIABLE CACHE)` statement in the CMakeLists.txt file. This makes the WarnUnusedCliUnused test run on all generators --- Tests/CMakeLists.txt | 29 +++++++++++------------------ Tests/WarnUnusedCliUnused/CMakeLists.txt | 8 ++++---- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index d992986..852b00f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2525,24 +2525,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release FAIL_REGULAR_EXPRESSION "CMakeLists.txt:5 \\(set\\):") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset") - if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND NOT WIN32) - # Ninja does not support ADDITIONAL_MAKE_CLEAN_FILES and therefore fails - # this test. (See #13371) - # Apparently Visual Studio does not support it either. As the MakeClean - # test above is only run with the Makefiles generator, only run this - # test with the Makefiles generator also. - add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/WarnUnusedCliUnused" - "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused" - ${build_generator_args} - --build-project WarnUnusedCliUnused - --build-options ${build_options} - "-DUNUSED_CLI_VARIABLE=Unused") - set_tests_properties(WarnUnusedCliUnused PROPERTIES - PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE") - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") - endif() + add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/WarnUnusedCliUnused" + "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused" + ${build_generator_args} + --build-project WarnUnusedCliUnused + --build-options ${build_options} + "-DUNUSED_CLI_VARIABLE=Unused") + set_tests_properties(WarnUnusedCliUnused PROPERTIES + PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") add_test(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND} --build-and-test diff --git a/Tests/WarnUnusedCliUnused/CMakeLists.txt b/Tests/WarnUnusedCliUnused/CMakeLists.txt index 7ed69bf..a149f04 100644 --- a/Tests/WarnUnusedCliUnused/CMakeLists.txt +++ b/Tests/WarnUnusedCliUnused/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.14) project(WarnUnusedCliUnused) -set_directory_properties(PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/CMakeCache.txt" -) +# Remove UNUSED_CLI_VARIABLE from the cache to trigger the +# CMake warning message on re-builds as well. +unset(UNUSED_CLI_VARIABLE CACHE) add_library(dummy empty.cpp) -- cgit v0.12 From 2532e00339d34e36e90f78a28c3e4ce882f6fac0 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 15 May 2019 12:55:48 +0200 Subject: FindDoxygen: Use ADDITIONAL_CLEAN_FILES for cleaning Replace use of the deprecated `ADDITIONAL_MAKE_CLEAN_FILES` directory property with the new `ADDITIONAL_CLEAN_FILES` directory property. --- Modules/FindDoxygen.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index 32b4aa2..ebd0b24 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -974,7 +974,7 @@ doxygen_add_docs() for target ${targetName}") "${DOXYGEN_OUTPUT_DIRECTORY}/${DOXYGEN_HTML_OUTPUT}") endif() set_property(DIRECTORY APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES "${_args_clean_html_dir}") + ADDITIONAL_CLEAN_FILES "${_args_clean_html_dir}") endif() # Build up a list of files we can identify from the inputs so we can list -- cgit v0.12 From ac86c02d1b6da921c93d53fed85ad70ab05c4608 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 15 May 2019 12:58:43 +0200 Subject: UseEcos: Use ADDITIONAL_CLEAN_FILES for cleaning Replace use of the deprecated `ADDITIONAL_MAKE_CLEAN_FILES` directory property with the new `ADDITIONAL_CLEAN_FILES` directory property. --- Modules/UseEcos.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index 1e82f16..60324b1 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -214,10 +214,10 @@ macro(ECOS_ADD_EXECUTABLE _exe_NAME ) ) #add the created files to the clean-files - set_directory_properties( - PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst;" - ) + set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES + "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin" + "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec" + "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst") add_custom_target(ecosclean ${CMAKE_COMMAND} -DECOS_DIR=${CMAKE_CURRENT_BINARY_DIR}/ecos/ -P ${ECOS_CMAKE_MODULE_DIR}/ecos_clean.cmake ) add_custom_target(normalclean ${CMAKE_MAKE_PROGRAM} clean WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -- cgit v0.12 From 8c47be28cc2e5d45c53a089b681257c0b8387964 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 15 May 2019 12:59:23 +0200 Subject: UseJava: Use ADDITIONAL_CLEAN_FILES for cleaning Replace use of the deprecated `ADDITIONAL_MAKE_CLEAN_FILES` directory property with the new `ADDITIONAL_CLEAN_FILES` directory property. --- Modules/UseJava.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index b0315b2..0798488 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -735,7 +735,8 @@ function(add_jar _TARGET_NAME) # this INTERFACE library depends on jar generation add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME}) - set_property (DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}") + set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES + "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}") endif() endfunction() -- cgit v0.12 From eda3963615e64f180e452b6e4bd1cce7f9fb14a9 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 15 May 2019 12:59:54 +0200 Subject: UseSWIG: Use ADDITIONAL_CLEAN_FILES for cleaning Replace use of the deprecated `ADDITIONAL_MAKE_CLEAN_FILES` directory property with the new `ADDITIONAL_CLEAN_FILES` directory property. --- Modules/UseSWIG.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index c136b05..78522da 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -708,9 +708,9 @@ function(SWIG_ADD_LIBRARY name) endif() endforeach() set_property (DIRECTORY APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES ${swig_generated_sources} ${swig_generated_timestamps}) + ADDITIONAL_CLEAN_FILES ${swig_generated_sources} ${swig_generated_timestamps}) if (UseSWIG_MODULE_VERSION VERSION_GREATER 1) - set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${outputdir}") + set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${outputdir}") endif() add_library(${target_name} -- cgit v0.12