[cmake-developers] Building executables as libraries

Brad King brad.king at kitware.com
Wed Mar 26 09:45:40 EDT 2014


On 03/26/2014 09:16 AM, Stephen Kelly wrote:
> My current exploratory hack involves modifying CMAKE_CXX_LINK_EXECUTABLE to 
> have content more-like CMAKE_CXX_CREATE_SHARED_LIBRARY.

The VS and Xcode generators do not use those variables, but could be
taught similar changes if this were to be a first-class feature.

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

Actually having add_executable create something besides cmTarget::EXECUTABLE
could cause other logic changes, even in project code that tests target
types.  Therefore we should probably delay the exe->lib mapping to be
just in the actual link step as above.

-Brad




More information about the cmake-developers mailing list