summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-03-08 20:14:23 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-03-08 20:14:23 (GMT)
commitfa0f0654262cd74824558c425083e22f091702e0 (patch)
tree4db05bf69daee1efebcc244e68f68539d5ea8726
parentda43d8fa8d96f5bb4363b3fd093af97c8735c432 (diff)
parentc5ae73316634b0d1fe56272ab011eefd9cb80e47 (diff)
downloadCMake-fa0f0654262cd74824558c425083e22f091702e0.zip
CMake-fa0f0654262cd74824558c425083e22f091702e0.tar.gz
CMake-fa0f0654262cd74824558c425083e22f091702e0.tar.bz2
Merge topic 'find_package_fatal_error_if_required_and_config_not_found'
c5ae733 find_package: Test that REQUIRED aborts processing correctly c91a54d find_package: error out if REQUIRED Config has not been found
-rw-r--r--Source/cmFindPackageCommand.cxx4
-rw-r--r--Tests/CMakeCommands/find_package/MissingConfig-stderr.txt6
-rw-r--r--Tests/CMakeCommands/find_package/MissingConfig.cmake1
-rw-r--r--Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt2
-rw-r--r--Tests/CMakeCommands/find_package/MissingConfigRequired.cmake1
-rw-r--r--Tests/CMakeCommands/find_package/MissingModule-stderr.txt5
-rw-r--r--Tests/CMakeCommands/find_package/MissingModule.cmake1
-rw-r--r--Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt2
-rw-r--r--Tests/CMakeCommands/find_package/MissingModuleRequired.cmake1
-rw-r--r--Tests/CMakeCommands/find_package/MissingNormal-stderr.txt6
-rw-r--r--Tests/CMakeCommands/find_package/MissingNormal.cmake1
-rw-r--r--Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt2
-rw-r--r--Tests/CMakeCommands/find_package/MissingNormalRequired.cmake1
13 files changed, 30 insertions, 3 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index e807bd5..f17002e 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1062,6 +1062,10 @@ bool cmFindPackageCommand::HandlePackageMode()
this->Makefile->IssueMessage(
this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());
+ if (this->Required)
+ {
+ cmSystemTools::SetFatalErrorOccured();
+ }
if (!aw.str().empty())
{
diff --git a/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt
index 0d14dcb..1eae0bb 100644
--- a/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt
+++ b/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt
@@ -11,3 +11,9 @@ CMake Warning at MissingConfig.cmake:1 \(find_package\):
been installed.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
+
+CMake Warning at MissingConfig.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/CMakeCommands/find_package/MissingConfig.cmake b/Tests/CMakeCommands/find_package/MissingConfig.cmake
index 3cebef1..238e7e4 100644
--- a/Tests/CMakeCommands/find_package/MissingConfig.cmake
+++ b/Tests/CMakeCommands/find_package/MissingConfig.cmake
@@ -1 +1,2 @@
find_package(NotHere CONFIG)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt
index 56325d8..2ba774a 100644
--- a/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt
+++ b/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt
@@ -10,4 +10,4 @@ CMake Error at MissingConfigRequired.cmake:1 \(find_package\):
"NotHere" provides a separate development package or SDK, be sure it has
been installed.
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake b/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake
index 3c28552..0ae6702 100644
--- a/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake
+++ b/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake
@@ -1 +1,2 @@
find_package(NotHere CONFIG REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/CMakeCommands/find_package/MissingModule-stderr.txt b/Tests/CMakeCommands/find_package/MissingModule-stderr.txt
index 71b5eae..2ad460f 100644
--- a/Tests/CMakeCommands/find_package/MissingModule-stderr.txt
+++ b/Tests/CMakeCommands/find_package/MissingModule-stderr.txt
@@ -19,3 +19,8 @@ CMake Warning \(dev\) at MissingModule.cmake:1 \(find_package\):
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning at MissingModule.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/CMakeCommands/find_package/MissingModule.cmake b/Tests/CMakeCommands/find_package/MissingModule.cmake
index 420539f..76bcef2 100644
--- a/Tests/CMakeCommands/find_package/MissingModule.cmake
+++ b/Tests/CMakeCommands/find_package/MissingModule.cmake
@@ -1 +1,2 @@
find_package(NotHere MODULE)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt
index c3cd350..fec05f1 100644
--- a/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt
+++ b/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt
@@ -18,4 +18,4 @@ CMake Warning \(dev\) at MissingModuleRequired.cmake:1 \(find_package\):
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake b/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake
index 07f36c5..897eda6 100644
--- a/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake
+++ b/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake
@@ -1 +1,2 @@
find_package(NotHere MODULE REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt
index e5cbd97..f4c6fba 100644
--- a/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt
+++ b/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt
@@ -15,3 +15,9 @@ CMake Warning at MissingNormal.cmake:1 \(find_package\):
been installed.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
+
+CMake Warning at MissingNormal.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/CMakeCommands/find_package/MissingNormal.cmake b/Tests/CMakeCommands/find_package/MissingNormal.cmake
index 778cd38..fb90e01 100644
--- a/Tests/CMakeCommands/find_package/MissingNormal.cmake
+++ b/Tests/CMakeCommands/find_package/MissingNormal.cmake
@@ -1 +1,2 @@
find_package(NotHere)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt
index ac52aec..7bb7902 100644
--- a/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt
+++ b/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt
@@ -14,4 +14,4 @@ CMake Error at MissingNormalRequired.cmake:1 \(find_package\):
"NotHere" provides a separate development package or SDK, be sure it has
been installed.
Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake b/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake
index 5c33fca..33353d8 100644
--- a/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake
+++ b/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake
@@ -1 +1,2 @@
find_package(NotHere REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")