Kasper Peeters
Kasper Peeters

Reputation: 1630

Android gradle complains about object library having multiple outputs

With gradle 6.5 I was able to build a cmake project which has a target which depends on an object library, something like

add_library(mylib 
            SHARED
            code1.cc
            code2.cc
            $<TARGET_OBJECTS:objlib
           )

where the object library is declared using something like

 add_library(objlib
             OBJECT
             src1.cc
             src2.cc
            )

So effectively this pulls src1.o and src2.o into mylib. I cannot really change this (e..g put those source files directly in the add_library for objlib).

With gradle 6.7.1, gradle complains that the target objlib has multiple outputs, namely src1.o and src2.o:

CMakeLists.txt : C/C++ release|armeabi-v7a : 
   Target renderer::@bfc844598bd03e848b3c produces multiple outputs [...]/src1.o, [...]/src2.o 

(paths edited for brevity).

I have tried to specify explicitly that I only want android to worry about the mylib target, by using the following in my build.gradle:

externalNativeBuild {
     cmake {
          targets "mylib"
     }
}

as suggested in Gradle fails to build a CMake project with OBJECT libraries because it expects a output file, but that does not work.

Upvotes: 4

Views: 770

Answers (0)

Related Questions