[CMake] Dependency not executed, why?

Thomas Lehmann t.lehmann at rtsgroup.net
Fri Nov 19 02:22:32 EST 2010


Hi,

I've found an example to use bison and flex in cmake.
I have a static library where I want to add the generated
sources but the dependencies are not triggered. Why?

project(test)

include_directories(.
                    ${CMAKE_BINARY_DIR}/libs/test)

add_custom_target(ScannerAndParser echo "Creating scanner.cxx and parser.cxx")

add_custom_command(
    SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l
    COMMAND flex
    ARGS -o ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx
            ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l
    TARGET ScannerAndParser
    DEPENDS ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx
    OUTPUTS ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx)

add_custom_command(
    SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/parser.y
    COMMAND bison
    ARGS -y -d ${CMAKE_CURRENT_SOURCE_DIR}/parser.y
         -o ${CMAKE_BINARY_DIR}/libs/test/parser.cxx
    TARGET ScannerAndParser
    DEPENDS ${CMAKE_BINARY_DIR}/libs/test/parser.cxx
    OUTPUTS ${CMAKE_BINARY_DIR}/libs/test/parser.cxx)

file(GLOB lib_sources *.cxx ${CMAKE_BINARY_DIR}/libs/test/scanner.cxx
                            ${CMAKE_BINARY_DIR}/libs/test/parser.cxx)

set_source_files_properties(${CMAKE_BINARY_DIR}/libs/test/parser.cxx GENERATED)

add_library(test STATIC ${lib_sources})
add_dependencies(test ScannerAndParser)



Thomas Lehmann
Scrum Master

[cid:rts-logo.png at fbda10bfcd534b0b8e20728cd423552e]

RTS Realtime Systems Software GmbH, Rembrandtstrasse 13, D-60596 Frankfurt am Main
T: +49.69.61009.0 / F: +49.69.61009.181

Sitz: Frankfurt am Main - HRB 84467 Amtsgericht Frankfurt am Main
Gesch?ftsf?hrer: Steffen Gemuenden, Igor Sluga

www.rtsgroup.net

This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify me immediately by return email and promptly delete this message and its attachments from your computer system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101119/fb9b90fe/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rts-logo.png
Type: image/png
Size: 13233 bytes
Desc: rts-logo.png
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101119/fb9b90fe/attachment-0001.png>


More information about the CMake mailing list