mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 14:50:15 -05:00
Merge topic 'FindPatch-script-mode'
04c5492cb0 FindPatch: Define imported target only for PROJECT CMAKE_ROLE
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10164
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
FindPatch
|
||||
---------
|
||||
|
||||
* The :module:`FindPatch` module now supports running in script mode by skipping
|
||||
the creation of the imported target.
|
||||
+11
-1
@@ -19,6 +19,9 @@ The following :prop_tgt:`IMPORTED` targets are also defined:
|
||||
``Patch::patch``
|
||||
The command-line executable.
|
||||
|
||||
.. versionchanged:: 3.32
|
||||
Imported target is defined only when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
|
||||
|
||||
Example usage:
|
||||
|
||||
.. code-block:: cmake
|
||||
@@ -60,12 +63,19 @@ endif()
|
||||
|
||||
mark_as_advanced(Patch_EXECUTABLE)
|
||||
|
||||
if(Patch_EXECUTABLE AND NOT TARGET Patch::patch)
|
||||
get_property(_patch_role GLOBAL PROPERTY CMAKE_ROLE)
|
||||
|
||||
if(
|
||||
_patch_role STREQUAL "PROJECT"
|
||||
AND Patch_EXECUTABLE
|
||||
AND NOT TARGET Patch::patch
|
||||
)
|
||||
add_executable(Patch::patch IMPORTED)
|
||||
set_property(TARGET Patch::patch PROPERTY IMPORTED_LOCATION ${Patch_EXECUTABLE})
|
||||
endif()
|
||||
|
||||
unset(_patch_path)
|
||||
unset(_patch_role)
|
||||
unset(_doc)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||
|
||||
Reference in New Issue
Block a user