mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-21 23:00:50 +08:00
cmake: Fix --find-package mode with imported targets
The change in commit v3.9.0-rc1~116^2~6 (cmakemain: use script role for -P, 2017-05-11) accidentally left project commands out of find-package mode, causing packages that provide imported targets to break. Fixes: #17124
This commit is contained in:
@@ -306,7 +306,7 @@ int do_cmake(int ac, char const* const* av)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
cmake::Role const role =
|
cmake::Role const role =
|
||||||
workingMode == cmake::NORMAL_MODE ? cmake::RoleProject : cmake::RoleScript;
|
workingMode == cmake::SCRIPT_MODE ? cmake::RoleScript : cmake::RoleProject;
|
||||||
cmake cm(role);
|
cmake cm(role);
|
||||||
cm.SetHomeDirectory("");
|
cm.SetHomeDirectory("");
|
||||||
cm.SetHomeOutputDirectory("");
|
cm.SetHomeOutputDirectory("");
|
||||||
|
@@ -5,5 +5,7 @@ find_path(FOO_INCLUDE_DIR NAMES foo.h HINTS "@CMAKE_CURRENT_SOURCE_DIR@" )
|
|||||||
set(FOO_LIBRARIES ${FOO_LIBRARY})
|
set(FOO_LIBRARIES ${FOO_LIBRARY})
|
||||||
set(FOO_INCLUDE_DIRS "${FOO_INCLUDE_DIR}" "/some/path/with a space/include" )
|
set(FOO_INCLUDE_DIRS "${FOO_INCLUDE_DIR}" "/some/path/with a space/include" )
|
||||||
|
|
||||||
|
add_library(Foo::Foo INTERFACE IMPORTED)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(Foo DEFAULT_MSG FOO_LIBRARY FOO_INCLUDE_DIR )
|
find_package_handle_standard_args(Foo DEFAULT_MSG FOO_LIBRARY FOO_INCLUDE_DIR )
|
||||||
|
Reference in New Issue
Block a user