project(":lib") {
    apply plugin: "cpp"
    model {
        components {
            main(NativeLibrarySpec)
        }

        // For any shared library binaries built with Visual C++,
        // define the DLL_EXPORT macro
        binaries {
            withType(SharedLibraryBinarySpec) {
                if (toolChain in VisualCpp) {
                    cppCompiler.define "DLL_EXPORT"
                }
            }
        }
    }
}

project(":exe") {
    apply plugin: "cpp"

    model {
        components {
            main(NativeExecutableSpec) {
                sources {
                    cpp {
                        lib project: ':lib', library: 'main'
                    }
                }
            }
        }
    }
}
