On 6/9/07, Stuart Herring <[EMAIL PROTECTED]> wrote:

On 6/9/07, Clark J. Wang <[EMAIL PROTECTED]> wrote:
>
> but it failed to cmake. So how can I let two executables share one
single
> object file?
>
You don't really want to.
The cost of compiling the same source file twice is minimal, and it's
much safer to compile them separately - it means that if you later
need to add different compile flags for the two executables that you
can without worry of one contaminating the other.


This makes sense. Thank you.

However, you could always build a static library and create the
executable from that:

ADD_LIBRARY(hellomain STATIC main.c)
ADD_EXECUTABLE(hello1 hello1.c)
ADD_EXECUTABLE(hello2 hello2.c)

TARGET_LINK_LIBRARIES(hello1 hellomain)
TARGET_LINK_LIBRARIES(hello2 hellomain)


This really works but I prefer not using it. ;-)

Regards,
Stuart.
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to