Skip to content

Templated targets #5206

Answered by waruqi
jj683 asked this question in Q&A
Discussion options

You must be logged in to vote

use function to wrap it.

function mytarget(name)
target(name)
  set_kind("binary")
  add_files("vector.cpp")
  add_files("set.cpp")
  add_files("main.cpp")
  add_links({"custom_library", "another_custom_library"})
end

mytarget("target-milk")
  add_defines("MILK")

mytarget("target-cheese")
  add_defines("CHEESE")

or define rule and use add_rules("xxx") for each targets

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jj683
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants