Yes, multiple commands can have different working directories in a custom target in CMake. Each command in a custom target can specify its own working directory using the WORKING_DIRECTORY
option. For example:
add_custom_target(my_target
COMMAND my_command1 arg1 arg2
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/dir1
COMMAND my_command2 arg3 arg4
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/dir2
)
In this example, my_command1
will be executed in the ${CMAKE_SOURCE_DIR}/dir1
directory, and my_command2
will be executed in the ${CMAKE_SOURCE_DIR}/dir2
directory.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-06-03 11:00:00 +0000
Seen: 15 times
Last updated: Mar 04 '23
How can multiple commands be executed using a single shortcut in Visual Studio Code's keybindings?
In nodejs, what is the process to delete the terminal and go back to previous commands?
What is the process of automating commands and cronjob expressions stored in a Laravel database?
How can INSTALL commands be excluded from the subdirectory (googletest directory) in CPack?
How can commands be run on a remote Linux system from within the vscode editor?
How do you combine the results of two commands in yt-dlp or youtube-dl?
What is the procedure for using multiple commands in VSCode's shortcut feature?