Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: handle builds that use static toolchain libs
The problem being solved here is: if a toolchain wants to link the toolchain libs statically, there are some flags that need to be passed. Unfortunately, static linking is notoriously order-sensitive (if an object needs a symbol, it can only be resolved by libraries _later_ than it on the command line). This means there are scenarios where: this works: gcc thing.o -o stuff -l:libstdc++.a this fails with missing symbols (like std::cout): gcc -l:libstdc++.a -o stuff thing.o In other words, we need these flags to be in "<LINK_LIBRARIES>" and not just "<LINK_FLAGS>", so they fall after the "<OBJECTS>" that might need them and that is what this code does, by injecting these indicative flags into CMAKE_CXX_STANDARD_LIBRARIES_INIT
- Loading branch information