One question, one suggestion:

If I do specify full paths, doesn't that mean that I'm forcing cmake to use 
static linking?  Doesn't this preclude one of the advantages of cmake - that 
it's easy to switch from static to dynamic linking?  (Not that I'm complaining! 
 I'm definitely going to use Bill's solution.)

And how about this behaviour:
- if TARGET_LINK_LIBRARIES() is given a full path or the name of a library that 
it knows about, the dependency is created (in other words, no change),
- if it is given a library name that it doesn't know about, it uses the 
standard method to find the library and adds the dependency (new behaviour),
- if it can't find the library then it prints a warning (new behaviour), and 
finally
- this behaviour is added to the documentation (which currently doesn't show 
TARGET_LINK_LIBRARIES being given pathnames, just library names, and which also 
doesn't mention TARGET_LINK_LIBRARIES adding dependencies at all).

Lezz

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Hoffman
Sent: Wednesday, December 03, 2008 9:23 AM
To: cmake@cmake.org
Subject: Re: [CMake] Rebuild target when external library changes?

Hugo Heden wrote:

> 
> Is there a reason for why CMake does not complain about the OP:s
> suggestion, "TARGET_LINK_LIBRARIES(hellow fred)"?
> 
> In general, I would want CMake to be stricter and complain more, to
> make it faster catching bugs like this . Is there a way (a command
> line flag, a variable or something) to make CMake stricter?
> 

The code you had was valid.  If CMake complained about every external 
library that was used without a full path 90% of the projects would be 
complaining.  Take for instance linking in libm on a unix machine.

target_link_libraries(foo m)

Many times this is a built in library, and you do not want to attempt to 
specify the full path to the library.  If you did, you would have to 
understand way too much about how each compiler figures stuff like that 
out.

However, I suppose it would not be that hard to add a global property 
that gave a warning for all non-full path library links.  I am just not 
sure how useful it would be.   However, as a matter of style it is 
certainly preferable to specify a full path to as many libraries as you can.

-Bill

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to