C++ Cross Compiling with mingw-w64: Is there a way to modify linker flags?

There’s an easier way to specify arguments specific to a platform:

binaries.all {
  if (targetPlatform == platforms.windows_x86) {
    cppCompiler.args "-m32", "-march=i686", "-mtune=generic"
 }
}

For settings that are not specific to any particular binary, you can also configure your toolChain to target a particular platform:

model {
  toolChains {
    gcc(Gcc) {
      target("windows_x86") {
        cppCompiler.withArguments { List<String> args ->
          // Full control over the argument list here: insert/append/remove/replace
          args << "-m32"
        }
      }
    }
  }
}
1 Like