Browse Source

Merge topic 'fix-find-package-mode'

18454ea4 cmake: Fix --find-package mode with imported targets

Acked-by: Kitware Robot <[email protected]>
Merge-request: !1208
Brad King 8 years ago
parent
commit
2df8dbcdf2
2 changed files with 3 additions and 1 deletions
  1. 1 1
      Source/cmakemain.cxx
  2. 2 0
      Tests/FindPackageModeMakefileTest/FindFoo.cmake.in

+ 1 - 1
Source/cmakemain.cxx

@@ -299,7 +299,7 @@ int do_cmake(int ac, char const* const* av)
     return ret;
   }
   cmake::Role const role =
-    workingMode == cmake::NORMAL_MODE ? cmake::RoleProject : cmake::RoleScript;
+    workingMode == cmake::SCRIPT_MODE ? cmake::RoleScript : cmake::RoleProject;
   cmake cm(role);
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");

+ 2 - 0
Tests/FindPackageModeMakefileTest/FindFoo.cmake.in

@@ -5,5 +5,7 @@ find_path(FOO_INCLUDE_DIR NAMES foo.h HINTS "@CMAKE_CURRENT_SOURCE_DIR@" )
 set(FOO_LIBRARIES ${FOO_LIBRARY})
 set(FOO_INCLUDE_DIRS "${FOO_INCLUDE_DIR}"  "/some/path/with a space/include" )
 
+add_library(Foo::Foo INTERFACE IMPORTED)
+
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Foo  DEFAULT_MSG  FOO_LIBRARY FOO_INCLUDE_DIR )