The problem become arris on big project.
It used qt, and when I add new file, it regenerate all stuff,
like moc files, ui_*.h files and so on,
this lead to rebuild corresponding C++ files,
and this is too long for me, and I also do not see, why
this should be so?

So I create smple test project to show the problem:
-------------------------------------------------------------------
PROJECT(test_rebuild)

ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/new_func.hpp
        COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate_new_func.sh >
${CMAKE_CURRENT_BINARY_DIR}/new_func.hpp
#       MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/generate_new_func.sh
        DEPENDS  ${CMAKE_CURRENT_SOURCE_DIR}/generate_new_func.sh
)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

SET(tr_SRCS
#       test.cpp
        foo.cpp
        main.cpp
)

SET(tr_HDRS
#       test.hpp
        foo.hpp
        ${CMAKE_CURRENT_BINARY_DIR}/new_func.hpp
)



ADD_EXECUTABLE(test_rebuild
        ${tr_SRCS}
        ${tr_HDRS}
)
-------------------------------------------------------------------

There is file new_func.hpp generated by generate_new_func.sh script,
there is foo.cpp which depends on new_func.hpp.

test.cpp and test.hpp do not depend on any other files.

But every time when I comment test.cpp test.hpp or uncomment
new_func.hpp regenerated and foo.cpp rebuild happened.

is it possible to fix this behaviour?

I use make file generatation.
>cmake --version
cmake version 2.7-20080530

> cat test.cpp
#include <cstdio>

#include "test.hpp"

void test_func()
{
        printf("%s: begin\n", __func__);
}

>cat foo.cpp
#include <cstdio>

#include "new_func.hpp"
#include "foo.hpp"

Foo::Foo()
{
        printf("%s: begin\n", __func__);
        new_func();
}

>cat build/new_func.hpp
#include <cstdio>
void new_func() { printf("aaa\n"); }
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to