Jeremy Cowgar wrote:
Bill Hoffman wrote:
One more option would be to run the parser every time cmake is run.
If you had an option to the parser that just spit out the list of
files you needed to compile, and it ran relatively fast, you could do
this:
# only run if parser.e is newer than source.cmake
if(parser.e IS_NEWER_THAN source.cmake)
execute_process(COMMAND myparser parser.e --sources sources.cmake)
endif()
I like this solution much better, but I have simplified things for my
example. I have been stating parser.e is the only input file. While that
is true, parser.e is known to depend on a set of other files. So, in the
above example I would need to check IS_NEWER_THAN a list of files I have:
SET( EU_CORE_FILES common.e emit.e error.e fwdref.e global.e inline.e
keylist.e main.e mode.e opnames.e parser.e
pathopen.e reswords.e scanner.e scinot.e shift.e symtab.e )
Is there a simple way of doing that?
Yes, with a function like this:
function(newer file)
math(EXPR ENDRANGE "${ARGC} - 1")
foreach(c RANGE 1 ${ENDRANGE}})
set(inputfile ${ARGV${c}})
if("${inputfile}" IS_NEWER_THAN "${file}")
set(IS_NEWER TRUE PARENT_SCOPE)
return()
endif()
endforeach()
set(IS_NEWER FALSE PARENT_SCOPE)
endfunction(newer)
SET( EU_CORE_FILES common.e emit.e error.e fwdref.e global.e inline.e
keylist.e main.e mode.e opnames.e parser.e
pathopen.e reswords.e scanner.e scinot.e shift.e symtab.e )
newer( source.cmake ${EU_CORE_FILES})
message("IS_NEWER = ${IS_NEWER}")
#IS_NEWER should be TRUE if any of the EU_CORE_FILES are newer than
# source.cmake
I like this solution as well, as you don't have to be running cmake from
cmake. It does mean that you have to be able to run the parser at
first cmake time.
-Bill
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake