How to globally set extra linker option like -lstdc++fs

I’m trying to build some third-party software which is failing as I’m using gcc8. I have to pass -lstdc++fs as linker option.
I cannot change cmake files so I would like to know if there is a way to set extra linker options as environment variable so it will be used if there are more than on cmake call.

Thank you

Take a look at LDFLAGS and various CMAKE_*_LINKER_FLAGS_INIT variables.

1 Like

I can export LDFLAGS from commandline but linker is still failing because of the order in which -lstdc++fs appears.
I want to -lstdc++fs to go at the end