[CMake] Generating multiple targets in parallel generates common prerequisites twice

Martin Apel martin.apel at simpack.de
Wed Jan 8 06:00:45 EST 2014


Hi Eike,

thanks for the pointer. I verified, that it works with the current git 
version of cmake.
So the problem will be fixed with the next CMake release.

Martin

On 08/01/14 10:00, Rolf Eike Beer wrote:
> Am 08.01.2014 09:42, schrieb Martin Apel:
>> Hi all,
>>
>> I hope this question hasn't been asked before, I haven't found
>> anything useful in the archive.
>>
>> Assume I have the following small CMakeLists.txt file:
>>
>> CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
>> PROJECT(testCMakeDeps)
>>
>> ADD_LIBRARY(foo SHARED foo.cpp)
>> ADD_LIBRARY(bar SHARED bar.cpp)
>>
>> ADD_EXECUTABLE(test test.cpp)
>> TARGET_LINK_LIBRARIES(test foo bar)
>>
>> ADD_EXECUTABLE(test2 test2.cpp)
>> TARGET_LINK_LIBRARIES(test2 foo bar)
>>
>> This creates two executables, which both depend on the same two shared
>> libraries. When generating a Makefile for this on Linux,
>> one can start the compilation process via 'make -j2 test test2', i.e.
>> name two separate targets on the command line.
>> However CMake seems to generate a Makefile, which does not work
>> correctly in this case. The shared libraries are generated twice.
>> This seems to be a CMake issue, not a Make issue, I can write a
>> Makefile by hand, which works correctly in this case.
>> Is there any way around the duplicate generation (which sometimes
>> fails, because the same libraries may be generated simultaneously)?
> Could you please try a CMake version from the next branch, I think that
> this has been fixed recently.
>
> Eike
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list