[CMake] avoid object file recompilation

Timur Ivanov timur.ivanov at gmail.com
Mon Jul 30 17:27:00 EDT 2007


Hello

I suspect that i am asking very basic question but i am very new to cmake

Suppose at top level CMakeLists.txt I have:

ADD_EXECUTABLE(test test.cpp ./common/common.cpp)
ADD_SUBDIRECTORY(test_1)
ADD_SUBDIRECTORY(test_2)

Then in test1 directory in CMakeLists.txt

ADD_EXECUTABLE(test_1 test_1.cpp ../common/common.cpp)

and in test2:

ADD_EXECUTABLE(test_2 test_2.cpp ../common/common.cpp)

The problem is that common.cpp recompiled 3 times but I would like not
to do that waste of time. Is it possible ?


More information about the CMake mailing list