External Libraries to Link exports as CMake variable

When I specify External Libraries to Link in Projucer under the Android exporter like so:


Then the generated target_link_libraries command in app/CMakeLists.txt looks like this:

target_link_libraries( ${BINARY_NAME}


This is treating the library names as CMake variables (which are not defined) resulting in not linking to libsome_library_a.a and libsome_library_b.a.

I’m inclined to think that Projucer should export the External Libraries to Link without the ${} surrounding the library names. Or am I missing something?

Specifying the libraries to link as part of Extra Linker Flags (like -lsome_library_a) add those names to CMAKE_SHARED_LINKER_FLAGS which in my case doesn’t seem to work for some reason.

Any tips on how to properly link prebuilt libraries?

This looks like it’s probably a bug. I’ll get that fixed.

1 Like

Thank you, this works!
Why are you putting the library names between square brackets?

The change, for future reference:

The square brackets are just slightly safer delimiters than ".


This change has appeared to break linking when the user library has an ${ANDROID_ABI} in the name, the variable apparently doesn’t make it through to the link step (which is obviously needed in most cases when doing multi-arch builds).

The previous way has worked just fine for me for a long time, so I’m not sure what the cause of the original poster’s issue is… there is a find_library() earlier in Projucer-generated CMakeLists.txt for each of the user libraries, and they must be working properly to define the variable version… perhaps they just weren’t for the original poster? Maybe not specifying the library path in the extra library search paths in the Debug/Release targets?

Incidentally, it’s the square brackets which break it… works fine with double quotes.