[CMake] linking hared libraries

Owen Alanzo Hogarth gurenchan at gmail.com
Mon Oct 19 08:43:54 EDT 2015


You made a few points that I have not seen before specifically using
$<TARGET_PROPERTY:vector3_scalar,INCLUDE_DIRECTORIES> and

$<TARGET_PROPERTY:vector3_scalar,INTERFACE_INCLUDE_DIRECTORIES>


Where are these commands, I just did a search and found a mailing list
that said they will override include_directories but I haven't seen
them before, especially in any of the tutorials that i've read on the
cmake site.


Also you said the PROJECT() should only be defined once, but shouldn't
each cmakelists.txt contain a project() or else cmake complains at me.


Hej,

A quick glance doesn't show anything out of the ordinary, except that
* I'd prevent any use of `..` in your folder references (by using things
like $<TARGET_PROPERTY:vector3_scalar,INCLUDE_DIRECTORIES> and
$<TARGET_PROPERTY:vector3_scalar,INTERFACE_INCLUDE_DIRECTORIES>
* I think it is more or less standard practice now to _not_ use
'include_directories', but instead use target_include_directories()
* you do add_subdirectory(source), but don't show the lists-file in that
folder, which may cause the problem you're seeing

The first thing I see that seems really wrong though, is that you type the
'project()' command twice. AFAIK you're supposed to use this command
exactly once, to set the properties of the entire project. Using it
multiple times causes undefined behaviour, and may very well be the cause
for what you're seeing

Sincerely,
Jakob


On Mon, Oct 19, 2015 at 5:43 PM, Owen Alanzo Hogarth <gurenchan at gmail.com>
wrote:

> Hi guys
>
> Can I get some help with this question I have. I did a really thorough
> writeup here on SO:
> http://stackoverflow.com/questions/33209659/cmake-no-rule-to-make-target-for-internal-shared-library?noredirect=1#comment54224377_33209659
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151019/95c031dc/attachment-0001.html>


More information about the CMake mailing list