[CMake] Using cmake to build a static library
axischire at gmail.com
Thu Sep 15 03:08:48 EDT 2011
have you looked at
not sure but worth giving it a try.
On Thu, Sep 15, 2011 at 3:49 AM, Denis Carniel <
denis.carniel at loginpeople.com> wrote:
> I came across cmake few weeks ago as a very interesting way to build
> projects for multiple platforms. It allows us at work to use a common code
> base for multiple platforms without actual duplication which is really neat.
> Though we're facing an issue related to the fact cmake isn't the only tool
> involved in our build process. We have split our code between the core logic
> which is compiled in C++ for multiple platforms (windows x86 and x86_64, Mac
> OSX and in the future linux) then based on that core logic we would like to
> produce SDKs for each platform using their specific features (for easier
> integration in projects).
> The problem is the following: The core logic is meant to be a static
> library (.lib on windows, .a on Mac / Linux) and then another project should
> pick up that library and include it into an executable. That final project
> is (a) not linked with the original cmake project (b) potentially not even
> built by cmake. For those reasons we'd like that the generated static
> library include its own dependencies in order to avoid dragging a long list
> of dependencies, unfortunately that does not seem to be be case in the
> current state of things.
> If I set the type of my output to "SHARED" (through the "ADD_LIBRARY"
> command), I see all dependencies appear in the Visual Studio project and the
> produced DLL seems correct. Though if the type is set to "STATIC" (the one
> we want), the dependencies are simply not passed to the Visual Studio
> project (AdditionalDependencies & AdditionalLibraryDirectories are not set
> for VCLibrarianTool).
> Hence my overall question: How can I have cmake produce a static library in
> which dependencies are linked ?
> Thanks in advance for your help.
> PS: I know DLLs work on windows but those are not an option, because of
> deployment constraints we need to produce a single executable file in the
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the CMake FAQ at:
> Follow this link to subscribe/unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the CMake