[CMake] How do static libraries get linked in Ninja?

Robert Maynard robert.maynard at kitware.com
Mon Jan 9 09:36:49 EST 2017


When I make an example project I see the following link line

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
   -Wl,-search_paths_first -Wl,-headerpad_max_install_names
CMakeFiles/example.dir/test.cpp.o  -o example  liblib1.a liblib2.a &&
:

Can you provide a short self contained example so I can try reproduce
the problem?

On Fri, Jan 6, 2017 at 2:12 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> The latter.
>
> On Thu, Jan 5, 2017 at 3:39 PM, Robert Maynard
> <robert.maynard at kitware.com> wrote:
>> Do you mean you don't see where the static library is created or where
>> the static library is listed on the link line for the dynamic library?
>>
>> On Thu, Jan 5, 2017 at 11:30 AM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
>>> I have two targets in CMake: a static library and a shared library.
>>> The shared library specifies the static library as a target link
>>> library.
>>>
>>> When I generate for Ninja, and I run:
>>>
>>> $ ninja -v
>>>
>>> During the link command for the shared library, I do not see the
>>> static library specified to g++. I do see *.so files, but not *.a
>>> files. Why are static libraries not showing up on the command line for
>>> the link step? There must be some black magic happening that I'm not
>>> seeing...
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list