Hi Oliver,

I think you already get a full set of valuable answer to your question.
And I would invite you as Bill said to prototype CMake usage
on real life subset of your project.

I would add some comments about the following:

2007/6/7, Oliver Kullmann <[EMAIL PROTECTED]>:
It appears now that the computational power of cmake is rather restricted?
There seem to be no functions?? (While we had hoped that there are many
more than in make?) Even just a shell-call seems to need to be programmed
by ourselves?? (I can't believe that, but couldn't find it.)

I think that the shell running feature of some make avatar
like GNU Make is just an escape door from Makefile language
itself.

You got just the same feature in CMake EXECUTE_PROCESS and/or
ADD_CUSTOM_COMMAND depending if you want CMake-time
or build-time execution.

You may write your "escape code" in whatever
modern and powerful scripting language you need like python, ruby etc...

if you want to make it appear "like" a CMake ability to execute
say, python code, you may write a CMake MACRO like

MACRO(PYTHON_EXECUTE CODE RESULT ERROR)
  SET(TMPFILE "/tmp/python_execute.py")
  FILE(WRITE ${TMPFILE} ${CODE})
  EXECUTE_PROCESS(COMMAND /usr/sfw/bin/python ${TMPFILE}
               TIMEOUT 10
               RESULT_VARIABLE PYTHON_RESULT
               OUTPUT_VARIABLE ${RESULT}
               ERROR_VARIABLE  ${ERROR}
               OUTPUT_STRIP_TRAILING_WHITESPACE)
  FILE(REMOVE ${TMPFILE})
ENDMACRO(PYTHON_EXECUTE)

and then use it like this:

PYTHON_EXECUTE("import time\nprint 'todays year is:'+
time.strftime('%Y',time.localtime())" MYVAR ERROR)
MESSAGE("MYVAR = ${MYVAR}")
MESSAGE("ERROR = ${ERROR}")

I think, that with some amount of time (not so much) for defining
your own WHATEVER_EXECUTE CMake MACROs
you'll get the power of what you add before
with shell running in Makefile.

You may try my example with the attached file
and run

cmake -P python_execute.cmake

This example is a toy example, I am sure you
may accomplish something far better and useful.

--
Erk

Attachment: python_execute.cmake
Description: Binary data

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to