[CMake] target_link_libraries from executable

Petr Kmoch petr.kmoch at gmail.com
Fri Mar 11 02:33:56 EST 2016


Hi Gilles,

I don't think you can get rid of this .lib, which is the import library.
Linking in the .exe/.dll world does not use the .exe or .dll file itself as
the item to be linked against, but its import library (.lib) instead. You
cannot link against a .dll if you only have the .dll, you need its import
library. The same holds true for executables.

So if you want to link against a.exe, you need its a.lib import library.

Petr

On Thu, Mar 10, 2016 at 7:04 PM, FOLLIC Gilles <gilles.follic at sgcib.com>
wrote:

> Hello,
>
>
>
> The idea is to get all the depedencies from an other project (executable).
>
>
>
> set_property(TARGET [EXECUTABLE] PROPERTY ENABLE_EXPORTS true)
>
> target_link_libraries(${PROJECT_NAME} [EXECUTABLE])
>
>
>
> This works perfectly, as I get all the include, libs I need, but I get on
> my
>
> visual studio a new lib from my [EXECUTABLE], called [EXECUTABLE].lib which
>
> I don't need since it is a executable, not a librairy.
>
>
>
> How can I do to remove this lib?
>
>
>
> Thank you
>
>
>
> Gilles
>
>
>
> *************************************************************************
> This message and any attachments (the "message") are confidential,
> intended solely for the addresse(s), and may contain legally privileged
> information.
> Any unauthorized use or dissemination is prohibited. E-mails are
> susceptible to alteration.
> Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall
> be liable for the message if altered, changed or
> falsified.
> Please visit http://swapdisclosure.sgcib.com for important information
> with respect to derivative products.
>                               ************
> Ce message et toutes les pieces jointes (ci-apres le "message") sont
> confidentiels et susceptibles de contenir des informations couvertes
> par le secret professionnel.
> Ce message est etabli a l'intention exclusive de ses destinataires. Toute
> utilisation ou diffusion non autorisee est interdite.
> Tout message electronique est susceptible d'alteration.
> La SOCIETE GENERALE et ses filiales declinent toute responsabilite au
> titre de ce message s'il a ete altere, deforme ou falsifie.
> Veuillez consulter le site http://swapdisclosure.sgcib.com afin de
> recueillir d'importantes informations sur les produits derives.
> *************************************************************************
>
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160311/cd934cb0/attachment.html>


More information about the CMake mailing list