Hi, Marcel,

What I mean is that I have a huge source tree and many CMake files and there is 
a source file inside this tree that needs to be built two times, because there 
will be an executable using it (non-PIC) and a shared library (PIC). So I have 
to create two targets (say MYLIB and MYLIBpic) that depend on the same source: 
SET(MYPROJECT_SRCS MyFile.hh MyFile.cc)

MyFile.hh is generated by a ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...) 
SET_SOURCE_FILE_PROPERTIES(MyFile.hh GENERATED TRUE HEADER_FILE_ONLY TRUE)

When two targets MYLIB and MYLIBpic are build in parallel, they both try to 
generate MyFile.hh without checking that MyFile.hh is already being generated 
by someone else.

So sometimes I end up with MyFile.hh where each line appears two times. 
Sometimes, #endif appears in the middle of the file, etc.

Denis

--- On Thu, 11/18/10, Marcel Loose <lo...@astron.nl> wrote:

> Hi Denis,
> 
> If you have two different build directories, which you need
> to have
> anyway when compiling with and without -fPIC, then you
> shouldn't have a
> problem, as long as you generate those header files in the
> build
> directory, which is IMHO the only sensible place to put
> generated files
> (your source tree might even be read-only!). Or maybe I
> completely
> misunderstood your question.
> 
> Best regards,
> Marcel Loose.


      
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to