Browse Source

Merge branch 'backport-find-no-name' into release-3.15

Merge-request: !3751
Brad King 6 years ago
parent
commit
aeeccc3b15

+ 1 - 1
Source/cmFindBase.cxx

@@ -141,7 +141,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
 
   // look for old style
   // FIND_*(VAR name path1 path2 ...)
-  if (!newStyle) {
+  if (!newStyle && !this->Names.empty()) {
     // All the short-hand arguments have been recorded as names.
     std::vector<std::string> shortArgs = this->Names;
     this->Names.clear(); // clear out any values in Names

+ 1 - 0
Tests/RunCMake/find_path/EmptyOldStyle-stdout.txt

@@ -0,0 +1 @@
+-- VAR-NOTFOUND

+ 2 - 0
Tests/RunCMake/find_path/EmptyOldStyle.cmake

@@ -0,0 +1,2 @@
+find_path(VAR ONLY_CMAKE_FIND_ROOT_PATH)
+message(STATUS "${VAR}")

+ 1 - 0
Tests/RunCMake/find_path/RunCMakeTest.cmake

@@ -1,5 +1,6 @@
 include(RunCMake)
 
+run_cmake(EmptyOldStyle)
 if(WIN32 OR CYGWIN)
   run_cmake(PrefixInPATH)
 endif()