[CMake] depend on ADD_CUSTOM_COMMAND

Brad King brad.king at kitware.com
Thu May 19 14:52:43 EDT 2005


klaas.holwerda wrote:
> How can i do it?
> 
> Thanks for any help here,
> 
> Klaas
> 
> ADD_LIBRARY( luawraps
>     luawrap.cpp
>    ${luawraps_BINARY_DIR}/src/wxLuaWrap.cpp
> )
> 
>    ADD_CUSTOM_COMMAND( OUTPUT ${luawraps_BINARY_DIR}/src/wxLuaWrap.cpp
>    COMMAND ${luawraps_BINARY_DIR}/src/wrap.bat
>    DEPENDS
>        ${luawraps_BINARY_DIR}/src/luasetup.h
>        ${luawraps_SOURCE_DIR}/src/luawraps.i    )

Switch the order of the commands so that when ADD_LIBRARY sees the 
source file it already knows that there is a rule to build it and will 
not complain that it does not exist.

ADD_CUSTOM_COMMAND( OUTPUT ${luawraps_BINARY_DIR}/src/wxLuaWrap.cpp
    COMMAND ${luawraps_BINARY_DIR}/src/wrap.bat
    DEPENDS ${luawraps_BINARY_DIR}/src/luasetup.h
            ${luawraps_SOURCE_DIR}/src/luawraps.i)
ADD_LIBRARY( luawraps
    luawrap.cpp
    ${luawraps_BINARY_DIR}/src/wxLuaWrap.cpp)

-Brad


More information about the CMake mailing list