From 0cf84472d7bf7c62b4f7db5052765cb88ec29eef Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Tue, 13 Mar 2012 21:19:56 +0100 Subject: [PATCH] find_package: additional test for checking the error message This patch adds a test which checks the error message, which is produced in the case that a Config file has set Foo_FOUND to FALSE by itself. Alex --- Tests/RunCMake/find_package/RunCMakeTest.cmake | 1 + Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt | 9 +++++++++ Tests/RunCMake/find_package/SetFoundFALSE.cmake | 2 ++ Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake | 1 + 4 files changed, 13 insertions(+) create mode 100644 Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt create mode 100644 Tests/RunCMake/find_package/SetFoundFALSE.cmake create mode 100644 Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index ba57f99e8..34fa73322 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -12,3 +12,4 @@ run_cmake(MissingConfigOneName) run_cmake(MissingConfigRequired) run_cmake(MissingConfigVersion) run_cmake(MixedModeOptions) +run_cmake(SetFoundFALSE) diff --git a/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt new file mode 100644 index 000000000..695f6450d --- /dev/null +++ b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning at SetFoundFALSE.cmake:2 \(find_package\): + Found package configuration file: + + .*/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake + + but it set SetFoundFALSE_FOUND to FALSE so package "SetFoundFALSE" is + considered to be NOT FOUND. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/SetFoundFALSE.cmake b/Tests/RunCMake/find_package/SetFoundFALSE.cmake new file mode 100644 index 000000000..fbcec3c56 --- /dev/null +++ b/Tests/RunCMake/find_package/SetFoundFALSE.cmake @@ -0,0 +1,2 @@ +set(SetFoundFALSE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +find_package(SetFoundFALSE CONFIG) diff --git a/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake b/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake new file mode 100644 index 000000000..ae6bd1454 --- /dev/null +++ b/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake @@ -0,0 +1 @@ +set(SetFoundFALSE_FOUND FALSE)