[cmake-developers] Building executables as libraries

Stephen Kelly steveire at gmail.com
Wed Mar 26 08:31:44 EDT 2014


J Decker wrote:

> I think this is impractical... the native activituy doesn't provide a hood
> to call 'main' and while you may have special code to treat main as an
> export and dynamically load it, actually stubstitute the single program
> with a loader dll and the program as a DLL, and the loader DLL has custom
> code depending on the package. The reason to do this is to support a
> package that support multiple entry points; the library and class name
> must be different to have a separate launcher icon

Thanks for the feedback. I do need sanity checking here :).

Your message seems to be concerned with use-cases mine was not concerned 
with though (such as multiple entry points). My proposal is concerned with 
writing cross-platform cmake code. So 

 add_executable(myappname ...)

instead of 

 if (ANDROID)
   add_library(myappname ...)
 elif(...)
   ...
 else()
   add_executable(myappname)
 endif()

In that scenario, I have an application (one entry point) which I want to 
build for multiple platforms.

Thanks,

Steve.






More information about the cmake-developers mailing list