Skip to content

Commit 9fb62ec

Browse files
committed
cmake: add RUN_ARGUMENTS parameter to declare app
1 parent 72dbdc0 commit 9fb62ec

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/cmake/modules/myci.cmake

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,10 +1099,13 @@ endfunction()
10991099

11001100
####
11011101
# @brief Declare application.
1102+
# - Declares application build target
1103+
# - Declares run-<name> target to run the application
11021104
# @param name - application name.
11031105
# @param SOURCES <file1> [<file2> ...] - list of source files. Required.
11041106
# @param RESOURCE_DIRECTORY <dir> - application resource directory. The resource directory will be copied to the
11051107
# application binary output directory.
1108+
# @param RUN_ARGUMENTS <arg1> [<arg2> ...] - list of command line arguments to be passed to the application by the run-<name> target. Optional.
11061109
# @param DEPENDENCIES <dep1> [<dep2> ...] - list of dependencies. Optional.
11071110
# If <depX> does not have any '::' in its name, then
11081111
# it will be searched with find_package(<depX> CONFIG) and if not found then searched with find_package(<depX> MODULE REQUIRED),
@@ -1124,15 +1127,20 @@ endfunction()
11241127
# On Windows, inidcates that a generated application will provide WinMain() function instead of main() as entry point.
11251128
# @param PREPROCESSOR_DEFINITIONS [<def1>[=<val1>] ...] - preprocessor macro definitions. Optional.
11261129
function(myci_declare_application name)
1127-
set(options GUI)
1128-
set(single RESOURCE_DIRECTORY)
1130+
set(options
1131+
GUI
1132+
)
1133+
set(single
1134+
RESOURCE_DIRECTORY
1135+
)
11291136
set(multiple
11301137
SOURCES
11311138
INCLUDE_DIRECTORIES
11321139
DEPENDENCIES
11331140
LINUX_ONLY_DEPENDENCIES
11341141
WINDOWS_ONLY_DEPENDENCIES
11351142
PREPROCESSOR_DEFINITIONS
1143+
RUN_ARGUMENTS
11361144
)
11371145
cmake_parse_arguments(arg "${options}" "${single}" "${multiple}" ${ARGN})
11381146

@@ -1240,8 +1248,10 @@ function(myci_declare_application name)
12401248

12411249
add_custom_command(TARGET run-${name}
12421250
POST_BUILD
1251+
WORKING_DIRECTORY
1252+
${myci_private_output_dir}/${name}
12431253
COMMAND
1244-
$<TARGET_FILE:${name}>
1254+
$<TARGET_FILE:${name}> ${arg_RUN_ARGUMENTS}
12451255
)
12461256
endfunction()
12471257

0 commit comments

Comments
 (0)