From dbe33b20bde8fd9a2196409a0df91245c082f653 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 27 Oct 2021 12:59:16 -0400 Subject: install: Add context to {PUBLIC,PRIVATE}_HEADER/RESOURCE DESTINATION warnings --- Source/cmInstallCommand.cxx | 16 ++++++++-------- Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt | 13 +++++++++++-- Tests/RunCMake/install/TARGETS-Defaults-stderr.txt | 13 +++++++++++-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index eaf88f6..193b9be 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -942,9 +942,9 @@ bool HandleTargetsMode(std::vector const& args, helper.GetIncludeDestination(&privateHeaderArgs)); } else { std::ostringstream e; - e << "INSTALL TARGETS - target " << target.GetName() << " has " + e << "Target " << target.GetName() << " has " << "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION."; - cmSystemTools::Message(e.str(), "Warning"); + helper.Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); } } @@ -964,9 +964,9 @@ bool HandleTargetsMode(std::vector const& args, helper.GetIncludeDestination(&publicHeaderArgs)); } else { std::ostringstream e; - e << "INSTALL TARGETS - target " << target.GetName() << " has " + e << "Target " << target.GetName() << " has " << "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION."; - cmSystemTools::Message(e.str(), "Warning"); + helper.Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); } } @@ -983,10 +983,10 @@ bool HandleTargetsMode(std::vector const& args, resourceGenerator = CreateInstallFilesGenerator( helper.Makefile, absFiles, resourceArgs, false); } else if (!target.IsAppBundleOnApple()) { - cmSystemTools::Message( - cmStrCat("INSTALL TARGETS - target ", target.GetName(), - " has RESOURCE files but no RESOURCE DESTINATION."), - "Warning"); + helper.Makefile->IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat("Target ", target.GetName(), + " has RESOURCE files but no RESOURCE DESTINATION.")); } } } diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt index 1939097..138a69d 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt @@ -1,2 +1,11 @@ -^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\. -INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$ +^CMake Warning \(dev\) at TARGETS-Defaults-Cache.cmake:[0-9]+ \(install\): + Target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at TARGETS-Defaults-Cache.cmake:[0-9]+ \(install\): + Target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION. +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/install/TARGETS-Defaults-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt index 1939097..5f56986 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt +++ b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt @@ -1,2 +1,11 @@ -^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\. -INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$ +^CMake Warning \(dev\) at TARGETS-Defaults.cmake:[0-9]+ \(install\): + Target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at TARGETS-Defaults.cmake:[0-9]+ \(install\): + Target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ -- cgit v0.12