[CMake] foreach et lists
Maxime Lecourt
maxime.lecourt at gmail.com
Wed Jun 22 10:11:17 EDT 2011
Hello,
I'm using CMake to do some OCaml building.
I launch the build command, using add_custom_command, so for the build to
actually trigger, I added the add_custom_target command.
Which I thought I did fine :
MACRO(OCAML_OPT LIST_OF_FILES)
message(STATUS ${LIST_OF_FILES})
FOREACH(FILE IN LISTS ${LIST_OF_FILES})
message(STATUS ${FILE})
get_filename_component(FILE_ROOT ${FILE} NAME_WE)
add_custom_command(OUTPUT ${output}
COMMAND ${CMAKE_OCaml_OPT_COMPILER}
"-I ${OCaml_ROOT_DIR}/lib"
"${FILE}"
)
add_custom_target(${NAME_WE}.cmi DEPENDS ${output})
ENDFOREACH(FILE)
ENDMACRO(OCAML_OPT)
But the output of this is
cabs.mlcxml.mlcprint.mlclexer.mllcparser.mlyctoxml.mlmergec.mlsortrec.mliftofor.mlgen.mlreduce.mllabel.mlalgo.mlcalipso.mlfrontc.ml
Configuring done
So while my LIST_OF_FILES is ok, apparently I mess up somewhere using
foreach (but where ?).
The list was created simply using
set(FRONTC_SOURCES
"cabs.ml"
"cxml.ml"
"cprint.ml"
"clexer.mll"
"cparser.mly"
"ctoxml.ml"
"mergec.ml"
"sortrec.ml"
"iftofor.ml"
"gen.ml"
"reduce.ml"
"label.ml"
"algo.ml"
"calipso.ml"
"frontc.ml"
)
Thanks for your help.
Regards,
Maxime
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110622/fbc9738a/attachment-0001.htm>
More information about the CMake
mailing list