[CMake] linking hared libraries

Owen Alanzo Hogarth gurenchan at gmail.com
Mon Oct 19 09:05:57 EDT 2015


also one more question.

I have a few header only files one in
common/common_structs.h

and
core_math/core_math.h

These files aren't compiled anywhere, they are just used as header only
files that I will eventually use to link in different versions of the
matrix and vector classes. For example I can have scalar math modules, sse
math modules or neon math modules. Depending on compiler flags those header
files will compile and include different versions, without changing the
public interface.

How can I handle that?

I still cannot find much information on using these constructs in my cmake
files.

$<TARGET_PROPERTY:vector3_scalar,INCLUDE_DIRECTORIES>


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

> 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/d071bf37/attachment.html>


More information about the CMake mailing list