[CMake] Execution order

David Aldrich David.Aldrich at EU.NEC.COM
Fri Sep 17 05:53:07 EDT 2010


Hi

I want to generate a source file 'SourceFileInfo.cpp', then build a library and then delete the generated file.

So I wrote:

<snip>

add_custom_command (
  OUTPUT SourceFileInfo.cpp
  COMMAND ../VersionInfo/_gnuRelease/versionInfo . KERNEL
  DEPENDS ${SRCS}
  COMMENT "Generating SourceFileInfo.cpp"
  VERBATIM)

list(APPEND SRCS SourceFileInfo.cpp)

add_library( Kernel STATIC ${SRCS} )

message("Removing file")
file( REMOVE SourceFileInfo.cpp )

But the message 'Removing file' appears as the first action when executing make and the file remains after make has finished.

I guess that one can't interpret a CMakeLists.txt file sequentially, just like you can't interpret a makefile sequentially.

What am I doing wrong?

Where can I find an explanation of CMake command ordering?

Best regards
David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100917/15335ba2/attachment.htm>


More information about the CMake mailing list