Native model cannot link if no source files

software-model

(Schalk Cronjé) #1

Maybe not a common use case, but definitely valid if migrating legacy builds. IN this case we have a number of libraries to link into an executable and one of them already has a main(). The model would be something like

model {
  components {
    hello(NativeExecutableSpec) {
         binaries.all {
           lib library: 'lib1', linkage: 'static'
           lib library: 'lib2', linkage: 'static'
         }
    }
  }
}

However, this would not create the executable as there are no C++ source files. The workaround is to drop an empty .cpp in src/hello/cpp.