MarkSchofield / WindowsToolchain

A repository containing a CMake toolchain for using MSVC
MIT License
106 stars 19 forks source link

link_directories and include_directories should not be called by toolchain #112

Open redbaron opened 2 months ago

redbaron commented 2 months ago

According to this CMake issue when toolchain calls link_directories and include_directories these are detected as <LANG>_IMPLICIT_{LINK,INCLUDE}_DIRECTORIES and therefore removed from command line args.

Clearly your toolchain works in practice, but I suspect there could be cases where it can backfire. In the same issue CMake maintainers recommend using CMAKE_<LANG>_STANDARD_LIBRARIES and CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES by the toolchains.

MarkSchofield commented 2 months ago

Issue #67 called out that include_directories are bad, and I fixed those occurrences with #69. I'd love to replace link_directories but CMAKE_<LANG>_STANDARD_LINK_DIRECTORIES hasn't been implemented yet - it looks like it might be coming in CMake 3.31 - CMAKE__STANDARD_LINK_DIRECTORIES. When that's shipped I'd definitely like to move to it.