cginternals/cmake-init

Use target_link_options to pass linker options

scheibel opened this issue · 0 comments

As of CMake 3.13, the previously missing function target_link_options was introduced. I suggest to use this instead of target_link_libraries. The current implementation does not allow passing linker options for MSVC.

Details:
Options (and linker options, too) start with a front slash for MSVC (e.g., /LTCG). As we use target_link_libraries to pass this option to the linker, CMake assumes library names to link against and gracefully converts our Unix-encoded path separator to Windows-encoded path separators, resulting in \LTCG being passed to the linker.