Commit be9d289f authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'deprecation-message'

f9737373 GenerateExportHeader: Port to use message(DEPRECATION)
f69606d3 Qt4Macros: Port to use message(DEPRECATION)
509c142a message: Add a DEPRECATION mode
parents f33068f6 f9737373
......@@ -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()
......
......@@ -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})
......
......@@ -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)
{
......
......@@ -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. "
......
......@@ -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";
......
......@@ -65,7 +65,9 @@ class cmake
INTERNAL_ERROR,
MESSAGE,
WARNING,
LOG
LOG,
DEPRECATION_ERROR,
DEPRECATION_WARNING
};
......
......@@ -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)
......
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\)
......
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\):
......
cmake_minimum_required(VERSION 2.8.4)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
include(RunCMake)
run_cmake(nomessage)
run_cmake(warnmessage)
run_cmake(errormessage)
CMake Deprecation Error at errormessage.cmake:4 \(message\):
This is an error
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
set(CMAKE_ERROR_DEPRECATED ON)
message(DEPRECATION "This is an error")
message(DEPRECATION "This is not issued")
CMake Deprecation Warning at warnmessage.cmake:4 \(message\):
This is a warning
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
set(CMAKE_WARN_DEPRECATED ON)
message(DEPRECATION "This is a warning")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment