[SOLVED] [Native build] Conditional sources sets

Yes. That’s the first thing I tried but I’m getting the following error:

Cannot create a CppSourceSet because this type is not known to this container. Known types are: NativeExecutableSpec, NativeLibrarySpec

This is a minimal grade.build throwing this error:

apply plugin: 'cpp'
apply plugin: 'visual-studio'

model {
    buildTypes {
        Debug
        Release
    }

    platforms {
        win32 {
            architecture "x86"
            operatingSystem "windows"
        }

        osx32 {
            architecture "x86"
            operatingSystem "osx"
        }
    }

    components {
        myLib(NativeLibrarySpec) {
            targetPlatform "win32"
            targetPlatform "osx32"

            sources {
                cpp {
                    source {
                        srcDir "code/src"
                        include "**/*.cpp"
                        exclude "platform"
                    }

                    exportedHeaders {
                        srcDir "code/include"
                        include "**/*.h"
                        exclude "platform"
                    }
                }
            }

            binaries.all {
                if (targetPlatform.operatingSystem.windows) {
                    sources {
                        win(CppSourceSet) {
                            srcDir "code/src"
                            include "platform/windows/**/*.cpp"
                        }
                    }
                }
            }
        }
    }
}