[cmake-developers] Building executables as libraries

Stephen Kelly steveire at gmail.com
Wed Mar 26 09:16:04 EDT 2014


Brad King wrote:

> On 03/21/2014 11:44 AM, Stephen Kelly wrote:
>> Should we try to add first-class support to CMake for building shared
>> libraries from CMake code like
>> 
>>  add_executable(...)
>> 
>> somehow? There would probably need to be some properties to control it,
>> but I wanted to raise the idea.
> 
> Would this be as simple as a platform information file variable that
> tells add_executable() to act like add_library() internally?

Perhaps, yes. 

My current exploratory hack involves modifying CMAKE_CXX_LINK_EXECUTABLE to 
have content more-like CMAKE_CXX_CREATE_SHARED_LIBRARY.

I didn't investigate whether deeper changes within CMake would be needed 
until the concept was somewhat-accepted.

Thanks,

Steve.





More information about the cmake-developers mailing list