Skip to content

Instantly share code, notes, and snippets.

@MambaWong
Forked from antiagainst/function-argument.cmake
Created April 30, 2016 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MambaWong/55760838805ac2efb965f845dddb5f79 to your computer and use it in GitHub Desktop.
Save MambaWong/55760838805ac2efb965f845dddb5f79 to your computer and use it in GitHub Desktop.
ARGC, ARGV, ARGN, ARGVn in CMake
cmake_minimum_required(VERSION 2.8)
function(use_llvm TARGET)
message("ARGC=\"${ARGC}\"")
message("ARGN=\"${ARGN}\"")
message("ARGV=\"${ARGV}\"")
message("ARGV0=\"${ARGV0}\"")
message("ARGV1=\"${ARGV1}\"")
endfunction()
add_custom_target(foo
COMMAND ls)
use_llvm(foo core bitwriter)
# Results:
# ARGC="3"
# ARGN="core;bitwriter"
# ARGV="foo;core;bitwriter"
# ARGV0="foo"
# ARGV1="core"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment