summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2010-06-22 03:21:28 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2010-06-22 03:21:28 +0200
commit3bb13593695d1db50885588cd96e1be85f5a8e45 (patch)
tree478e5e07d391cd6a68fd1eaa4444d484a88d3ab0 /cmake
parent405b5ba0aa85b5155fb45df5407b69b1441ada75 (diff)
downloadephraim-3bb13593695d1db50885588cd96e1be85f5a8e45.tar
ephraim-3bb13593695d1db50885588cd96e1be85f5a8e45.zip
Added header and option support to Erlang CMake build
Diffstat (limited to 'cmake')
-rw-r--r--cmake/erlang/ErlangTarget.cmake40
1 files changed, 25 insertions, 15 deletions
diff --git a/cmake/erlang/ErlangTarget.cmake b/cmake/erlang/ErlangTarget.cmake
index cfcc431..3a21800 100644
--- a/cmake/erlang/ErlangTarget.cmake
+++ b/cmake/erlang/ErlangTarget.cmake
@@ -1,25 +1,35 @@
macro(erl_target name)
- set(in_files "")
+ parse_arguments(ARGS "HEADERS;OPTIONS" "" ${ARGN})
+
+ set(headers "")
set(out_files "")
- foreach(src ${ARGN})
- list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
+ foreach(header ${ARGS_HEADERS})
+ list(APPEND headers "${CMAKE_CURRENT_SOURCE_DIR}/${header}")
+ endforeach(header ${ARGS_HEADERS})
+
+ foreach(src ${ARGS_DEFAULT_ARGS})
+ set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
string(REPLACE ".erl" ".beam" src ${src})
set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${src}")
+
+ add_custom_command(
+ OUTPUT
+ ${out_file}
+ COMMAND
+ ${ERLC_EXECUTABLE}
+ ARGS
+ "-o" ${CMAKE_CURRENT_BINARY_DIR}
+ ${ARGS_OPTIONS}
+ ${in_file}
+ DEPENDS
+ ${in_file}
+ ${headers}
+ )
+
list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${src}")
- endforeach(src ${ARGN})
+ endforeach(src ${ARGS_DEFAULT_ARGS})
- add_custom_command(
- OUTPUT
- ${out_files}
- COMMAND
- ${ERLC_EXECUTABLE}
- ARGS
- "-o" ${CMAKE_CURRENT_BINARY_DIR}
- ${in_files}
- DEPENDS
- ${in_files}
- )
add_custom_target(
${name} ALL DEPENDS ${out_files}
)