Embarcadero: Run at most one linker invocation at a time (#15620)

At least some versions (e.g. C++ Builder 5) of the bcc32 linker are known to
write temporary files with a constant name to the current directory (e.g.
"turboc.$ln").  (This can be verified by using Process Monitor to watch the
file writes that bcc32 / ilink32 / implib make).  This causes problems with
some generators that keep a constant current directory and run concurrent
linkers.

For example, the Ninja generator, by default, always has the current directory
set to the top of the build tree - resulting in conflicts between the linkers
that are simultaneously trying to write to "turboc.$ln".  Symptoms include
direct errors regarding the "turboc.$ln" file, or later build steps failing due
to corrupted output from previous links that happened to link "successfully."

This is not a problem for the Borland Makefiles generator which does not
run jobs in parallel.  For the Ninja generator, work around this problem
by using a link job pool of size 1.
This commit is contained in:
James Johnston 2015-06-18 17:17:38 +00:00 committed by Brad King
parent e2e6cb7348
commit 078b60f05c
1 changed files with 6 additions and 0 deletions

View File

@ -74,6 +74,12 @@ set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT})
# The Borland link tool does not support multiple concurrent
# invocations within a single working directory.
if(NOT DEFINED CMAKE_JOB_POOL_LINK)
set(CMAKE_JOB_POOL_LINK BCC32LinkPool)
set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1)
endif()
macro(__embarcadero_language lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list