[CMake] How to use lib from include_external_msproject

Klaim - Joël Lamotte mjklaim at gmail.com
Thu Aug 20 18:53:48 EDT 2015


On 20 August 2015 at 17:33, Howard Rubin <howard.rubin at hl.konicaminolta.us>
wrote:

> I have a C++/CLI LIB (and DLL) that I generate with
> include_external_msproject. I need to link to it from my C++ project, which
> I’m trying to do with target_link_libraries. This gives the below error
> message. Since I’m not creating it with add_library I don’t see how to
> indicate it’s a shared lib.
>
>
>
> How can I indicate the lib is a SHARED lib, or otherwise link to it in a
> CMake project?
>
>
>

Simply put, you cannot use  target_link_libraries() with targets created
with include_external_msproject().
To make it work, just use add_dependencies() instead.
I don't remember how to specify SHARED in this case but I think it totally
depends on the settings of the VS project file.
It's one of the reasons some old project distribute the project file twice,
one as shared library, the other as static library.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150821/dbab4eef/attachment.html>


More information about the CMake mailing list