the list of sources. But another problem came up: Only the first single
list item seems to be scanned for implicit dependencies. And I failed to
come up with a list or command syntax that would allow me to have the
other 99+ sources scanned as well.

I think I came up with a usable workaround for now. A semaphore file is
created for every source file which IMPLICIT_DEPENDS on that source
file, and my actual version.cc now depends on all the semaphore files.

Basically this:


foreach (srcfile ${SOURCEFILES})
  string(REPLACE "/" "_" srcok ${srcfile})
  set(semafile dep_${srcok})
  add_custom_command(
    OUTPUT ${semafile}
    COMMAND touch ${semafile}
    IMPLICIT_DEPENDS CXX ${PROJECT_SOURCE_DIR}/src/${srcfile}
    COMMENT ""
  )
  set(VERSION_DEPFILES ${VERSION_SEMAFILES} ${semafile})
endforeach(srcfile)

add_custom_command(
  OUTPUT version.cc
  COMMAND create_version_cc.sh
  DEPENDS ${VERSION_SEMAFILES}
)

I'm open for improvements and better ideas...

Kolja



_______________________________________________
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

Reply via email to