changeset 198:4051c012dec3

cmake macro
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Dec 2016 21:48:40 +0900
parents de7c0bbfc91f
children 9c85c3a34726
files src/parallel_execution/CMakeLists.txt
diffstat 1 files changed, 19 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/CMakeLists.txt	Fri Dec 16 23:41:27 2016 +0900
+++ b/src/parallel_execution/CMakeLists.txt	Sun Dec 18 21:48:40 2016 +0900
@@ -5,26 +5,31 @@
 add_definitions("-Wall -g")
 
 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER})
-
  
 add_custom_command (
       OUTPUT    c/enumCode.h
       COMMAND  "perl" "generate_context.pl"
 )
 
+macro( GearsCommand )
 
-add_executable(twice
-               main.c
-               context.c
-               rb_tree.c
-               stack.c
-               origin_cs.c
-               allocate.c
-               compare.c
-               worker.c
-               dependency.c
-               time.c
-               twice.c
-               c/enumCode.h
+    set( _OPTIONS_ARGS )
+    set( _ONE_VALUE_ARGS TARGET )
+    set( _MULTI_VALUE_ARGS SOURCES )
+
+    cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+    # message("target =  ${_Gears_TARGET}")
+    # message("sources =  ${_Gears_SOURCES}")
+
+    add_executable(${_Gears_TARGET} ${_Gears_SOURCES})
+endmacro()
+
+GearsCommand(
+  TARGET
+      twice
+  SOURCES 
+      main.c 
+      context.c rb_tree.c stack.c origin_cs.c allocate.c compare.c worker.c dependency.c time.c twice.c c/enumCode.h
 )