[CMake] Rebuild target when external library changes?

Bill Hoffman bill.hoffman at kitware.com
Wed Dec 3 09:22:47 EST 2008


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



More information about the CMake mailing list