My question about using cmake functions in add_custom/_target/commands, which is a continuation to How to call a CMake function from add_custom_target/command? and CMake: execute a macro/function as the command of add_custom_command
at present my code is written as functions and sometimes called recursively, I understand above links suggest to use CMAKE script, Can we have multiple functions in that cmake script? if yes where do we mention the function name during call? would such CMAKE script look like below?
function(name1)
endfunction()
function(name2)
endfunction()
can someone share the content of such cmake script with functions?
COMMAND ${CMAKE_COMMAND} -P path_to_scriptdoes: it tells CMake to execute given script, that is performs commands listed in that script, line by line. As usual, actions listed in function's definition (function(name1)...endfunction()) are performed only at function's invocation. Also, executed script doesn't see function's declared in theCMakeLists.txtcalled it.add_custom_commandandadd_custom_targetare executed by the build system, which could run them concurrently (e.g. withmake -j).