diff options
author | Brad King <brad.king@kitware.com> | 2013-10-09 14:24:16 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-10-09 14:24:16 (GMT) |
commit | be9d289fcef487753a5c88268e9ed4262e39633b (patch) | |
tree | 40564b3e417c7fdea74b69dae5f6c99e3c2aad3c | |
parent | f33068f6157bf1cbba2f37df0f41c80aa5fb19a5 (diff) | |
parent | f973737305aaa48ddf26f4455bdc8acdd7d03573 (diff) | |
download | CMake-be9d289fcef487753a5c88268e9ed4262e39633b.zip CMake-be9d289fcef487753a5c88268e9ed4262e39633b.tar.gz CMake-be9d289fcef487753a5c88268e9ed4262e39633b.tar.bz2 |
Merge topic 'deprecation-message'
f973737 GenerateExportHeader: Port to use message(DEPRECATION)
f69606d Qt4Macros: Port to use message(DEPRECATION)
509c142 message: Add a DEPRECATION mode
-rw-r--r-- | Modules/GenerateExportHeader.cmake | 10 | ||||
-rw-r--r-- | Modules/Qt4Macros.cmake | 20 | ||||
-rw-r--r-- | Source/cmMessageCommand.cxx | 17 | ||||
-rw-r--r-- | Source/cmMessageCommand.h | 8 | ||||
-rw-r--r-- | Source/cmake.cxx | 9 | ||||
-rw-r--r-- | Source/cmake.h | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/message/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/message/RunCMakeTest.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/message/errormessage-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/message/errormessage-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/message/errormessage.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/message/nomessage-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/message/nomessage-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/message/nomessage.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/message/warnmessage-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/message/warnmessage-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/message/warnmessage.cmake | 4 |
20 files changed, 70 insertions, 33 deletions
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index b2fda09..fb113a7 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -337,15 +337,7 @@ endfunction() function(add_compiler_export_flags) if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) - if(CMAKE_WARN_DEPRECATED) - set(messageType WARNING) - endif() - if(CMAKE_ERROR_DEPRECATED) - set(messageType FATAL_ERROR) - endif() - if(messageType) - message(${messageType} "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.") - endif() + message(DEPRECATION "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.") endif() _test_compiler_hidden_visibility() diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index f1aedd7..74bad89 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -355,15 +355,7 @@ endmacro() macro(QT4_AUTOMOC) if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11) - if(CMAKE_WARN_DEPRECATED) - set(messageType WARNING) - endif() - if(CMAKE_ERROR_DEPRECATED) - set(messageType FATAL_ERROR) - endif() - if(messageType) - message(${messageType} "The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.") - endif() + message(DEPRECATION "The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.") endif() QT4_GET_MOC_FLAGS(_moc_INCS) @@ -476,15 +468,7 @@ endmacro() function(qt4_use_modules _target _link_type) if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11) - if(CMAKE_WARN_DEPRECATED) - set(messageType WARNING) - endif() - if(CMAKE_ERROR_DEPRECATED) - set(messageType FATAL_ERROR) - endif() - if(messageType) - message(${messageType} "The qt4_use_modules function is obsolete. Use target_link_libraries with IMPORTED targets instead.") - endif() + message(DEPRECATION "The qt4_use_modules function is obsolete. Use target_link_libraries with IMPORTED targets instead.") endif() if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE") set(modules ${ARGN}) diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index e1dbf34..d85e720 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -52,6 +52,23 @@ bool cmMessageCommand status = true; ++i; } + else if (*i == "DEPRECATION") + { + if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) + { + fatal = true; + type = cmake::DEPRECATION_ERROR; + } + else if (this->Makefile->IsOn("CMAKE_WARN_DEPRECATED")) + { + type = cmake::DEPRECATION_WARNING; + } + else + { + return true; + } + ++i; + } for(;i != args.end(); ++i) { diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index fc61810..a053bdd 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -60,9 +60,8 @@ public: virtual const char* GetFullDocumentation() const { return - " message([STATUS|WARNING|AUTHOR_WARNING|FATAL_ERROR|SEND_ERROR]\n" - " \"message to display\" ...)\n" - "The optional keyword determines the type of message:\n" + " message([<mode>] \"message to display\" ...)\n" + "The optional <mode> keyword determines the type of message:\n" " (none) = Important information\n" " STATUS = Incidental information\n" " WARNING = CMake Warning, continue processing\n" @@ -70,6 +69,9 @@ public: " SEND_ERROR = CMake Error, continue processing,\n" " but skip generation\n" " FATAL_ERROR = CMake Error, stop processing and generation\n" + " DEPRECATION = CMake Deprecation Error or Warning if variable\n" + " CMAKE_ERROR_DEPRECATED or CMAKE_WARN_DEPRECATED\n" + " is enabled, respectively, else no message.\n" "The CMake command-line tool displays STATUS messages on stdout " "and all other message types on stderr. " "The CMake GUI displays all messages in its log area. " diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2249323..d2961c0 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3127,6 +3127,15 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, { msg << "CMake Debug Log"; } + else if(t == cmake::DEPRECATION_ERROR) + { + msg << "CMake Deprecation Error"; + isError = true; + } + else if (t == cmake::DEPRECATION_WARNING) + { + msg << "CMake Deprecation Warning"; + } else { msg << "CMake Warning"; diff --git a/Source/cmake.h b/Source/cmake.h index ccf91e3..d33ba34 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -65,7 +65,9 @@ class cmake INTERNAL_ERROR, MESSAGE, WARNING, - LOG + LOG, + DEPRECATION_ERROR, + DEPRECATION_WARNING }; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index ee490b8..4fbc3b0 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -95,6 +95,7 @@ add_RunCMake_test(if) add_RunCMake_test(include) add_RunCMake_test(include_directories) add_RunCMake_test(list) +add_RunCMake_test(message) add_RunCMake_test(try_compile) add_RunCMake_test(variable_watch) add_RunCMake_test(CMP0004) diff --git a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt index 6f7e8ee..f358cc4 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt +++ b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\): +CMake Deprecation Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\): The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead. Call Stack \(most recent call first\): AutomocMacro-WARN.cmake:7 \(qt4_automoc\) diff --git a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt index b90c665..c69af65 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt +++ b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\): +CMake Deprecation Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\): The qt4_use_modules function is obsolete. Use target_link_libraries with IMPORTED targets instead. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/message/CMakeLists.txt b/Tests/RunCMake/message/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/message/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake new file mode 100644 index 0000000..d2bc0c3 --- /dev/null +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(nomessage) +run_cmake(warnmessage) +run_cmake(errormessage) diff --git a/Tests/RunCMake/message/errormessage-result.txt b/Tests/RunCMake/message/errormessage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/message/errormessage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/message/errormessage-stderr.txt b/Tests/RunCMake/message/errormessage-stderr.txt new file mode 100644 index 0000000..49e7ca9 --- /dev/null +++ b/Tests/RunCMake/message/errormessage-stderr.txt @@ -0,0 +1,4 @@ +CMake Deprecation Error at errormessage.cmake:4 \(message\): + This is an error +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/message/errormessage.cmake b/Tests/RunCMake/message/errormessage.cmake new file mode 100644 index 0000000..7d3b779 --- /dev/null +++ b/Tests/RunCMake/message/errormessage.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_ERROR_DEPRECATED ON) + +message(DEPRECATION "This is an error") diff --git a/Tests/RunCMake/message/nomessage-result.txt b/Tests/RunCMake/message/nomessage-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/message/nomessage-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/message/nomessage-stderr.txt b/Tests/RunCMake/message/nomessage-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/message/nomessage-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/message/nomessage.cmake b/Tests/RunCMake/message/nomessage.cmake new file mode 100644 index 0000000..bcc97be --- /dev/null +++ b/Tests/RunCMake/message/nomessage.cmake @@ -0,0 +1,2 @@ + +message(DEPRECATION "This is not issued") diff --git a/Tests/RunCMake/message/warnmessage-result.txt b/Tests/RunCMake/message/warnmessage-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/message/warnmessage-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/message/warnmessage-stderr.txt b/Tests/RunCMake/message/warnmessage-stderr.txt new file mode 100644 index 0000000..5c44566 --- /dev/null +++ b/Tests/RunCMake/message/warnmessage-stderr.txt @@ -0,0 +1,4 @@ +CMake Deprecation Warning at warnmessage.cmake:4 \(message\): + This is a warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/message/warnmessage.cmake b/Tests/RunCMake/message/warnmessage.cmake new file mode 100644 index 0000000..4c421a1 --- /dev/null +++ b/Tests/RunCMake/message/warnmessage.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_WARN_DEPRECATED ON) + +message(DEPRECATION "This is a warning") |