Skip to content

VS: Decide project type by linker lang as fallback

In regards to #16738 (closed) it appears to be sufficient to make the logic regarding the project language based on LINKER_LANGUAGE if there's more than one source language present:

  • If there's only Fortran raw sources and some C++ library being linked, due to default propagation rules, LINKER_LANGUAGE will default to CXX, but the linker will be the Fortran one. Given this is the only way to get the code to build in this setup, and the CXX settings from MSVC won't cause too much harm, it's the best way to deal with this situation - and the only backwards compatible one.

  • If there's C++ and Fortran objects mixed, LINKER_LANGUAGE decides the language of the linker, by default CXX then, as before.

  • If there's mixed language source and objects thrown together, LINKER_LANGUAGE decides what is being built with. Given it's impossible to know where the entry point routine would be, there doesn't seem to be a guess that would be preferable above others. With other generators, one would need to adjust the linker preferences, and the same adjustment would work in this case.

So far, this seems to be the best solution for the issue, and one could later on adjust the selection of LINKER_LANGUAGE for the first scenario.

Fixes: #16738 (closed)

Merge request reports