Pull request for a commit to support language-specific link flags
The preliminary discussion of this pull request occurs in a thread starting at https://cmake.org/pipermail/cmake/2019-August/069877.html.
This update to CMake is essential because it allows compilers for different languages that have different formats for link options (e.g., gcc for C and dmd for D) to be used in the same build.
This commit (see the attached compressed format-patch result for the final form of this commit) started life as
commit 5b7e123b27489fb4a6dcf943116821cf073532fe Author: Ben Boeckel <email@example.com> Date: Tue Apr 15 00:21:15 2014 -0400 linking: Support language-specific link flags
in this unofficial version of CMake. I rebased this commit on the official CMake master branch (which required some conflict resolution).
I used PLplot to test the current pull request for CMake. PLplot builds language bindings for our C plotting library and corresponding examples written in a number of different computer languages including D, where the CMake language support for D is provided by a patched form of the cmake-d project. PLplot provides stringent tests of our D binding and examples (where we compare SVG plot file results for our ~30 D examples with corresponding results for the equivalent C examples) for our three major PLplot configurations (shared libraries + dynamic devices, shared libraries + nondynamic devices, and static libraries + nondynamic devices). And for a version of CMake updated by the current pull request, those test results were perfect for all three D compilers (gdc, ldc, and dmd) that are supported by cmake-d. Equivalent test results for a version of CMake that is not updated with the current pull request were perfect for gdc (because gdc has the same linking flags as the other Linux compilers used by PLplot) but fail for ldc and dmd. The reason for those failures without the current pull request is ldc and dmd use different linking flags than the rest of the Linux compilers used by PLplot and the (patched) cmake-d support for ldc and dmd depends on the language-specific link flags that are implemented by the current pull request.