aboutsummaryrefslogtreecommitdiff
path: root/cmake/DefCmdTarget.cmake
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-06-19 19:51:16 +0200
committerGitHub <noreply@github.com>2022-06-19 19:51:16 +0200
commitb2ed439bd5ab1b431bb61f8754554c48453495c5 (patch)
treeac510cd24c54ef9a49a9d3865cb61152cd9cfe6b /cmake/DefCmdTarget.cmake
parenta195dc7c83b3da16e293ddb468ef18254957b4a4 (diff)
parentae7a4ad3d70c5a7653d2211dd89884d401186ab2 (diff)
downloadrneovim-b2ed439bd5ab1b431bb61f8754554c48453495c5.tar.gz
rneovim-b2ed439bd5ab1b431bb61f8754554c48453495c5.tar.bz2
rneovim-b2ed439bd5ab1b431bb61f8754554c48453495c5.zip
Merge #19015 delete cmake code
Diffstat (limited to 'cmake/DefCmdTarget.cmake')
-rw-r--r--cmake/DefCmdTarget.cmake32
1 files changed, 12 insertions, 20 deletions
diff --git a/cmake/DefCmdTarget.cmake b/cmake/DefCmdTarget.cmake
index 1ee5cdd60e..48e90cf5c8 100644
--- a/cmake/DefCmdTarget.cmake
+++ b/cmake/DefCmdTarget.cmake
@@ -1,27 +1,19 @@
-# Defines a target named ${target} and a command with (symbolic) output
-# ${target}-cmd. If ${prg} is undefined the target prints "not found".
+# Defines a target named ${target}. If ${prg} is undefined the target prints
+# "not found".
#
-# - Use add_custom_command(…APPEND) to build the command after this.
-# - Use add_custom_target(…DEPENDS) to run the command from a target.
+# - Use add_custom_command(TARGET <target_name> ...) to append a command to the
+# target.
function(def_cmd_target target prg prg_name prg_fatal)
- # Define a mostly-empty command, which can be appended-to.
- add_custom_command(OUTPUT ${target}-cmd
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMAND ${CMAKE_COMMAND} -E echo "${target}"
- )
- # Symbolic (does not generate an artifact).
- set_source_files_properties(${target}-cmd PROPERTIES SYMBOLIC "true")
+ add_custom_target(${target})
- if(prg OR NOT prg_fatal)
- add_custom_target(${target}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ${target}-cmd)
- if(NOT prg)
- add_custom_command(OUTPUT ${target}-cmd APPEND
+ if(NOT prg)
+ if(prg_fatal)
+ add_custom_command(TARGET ${target}
+ COMMAND ${CMAKE_COMMAND} -E echo "${target}: ${prg_name} not found"
+ COMMAND false)
+ else()
+ add_custom_command(TARGET ${target}
COMMAND ${CMAKE_COMMAND} -E echo "${target}: SKIP: ${prg_name} not found")
endif()
- else()
- add_custom_target(${target} false
- COMMENT "${target}: ${prg_name} not found")
endif()
endfunction()