Re: [cmake-developers] target_link_libraries links mathlib as -lm rather than /libm.so, why?

2019-06-18 Thread Brad King
On 6/17/19 11:22 PM, Alan W. Irwin wrote:
> target_link_libraries(  /usr/lib/x86_64-linux-gnu/libm.so)
> 
> results in an actual link option "-lm".

Thanks.  I can reproduce that and have opened an issue with an explanation:

  https://gitlab.kitware.com/cmake/cmake/issues/19399

It occurs when the `.so` is a GNU ld script instead of an actual binary.

-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers


[cmake-developers] target_link_libraries links mathlib as -lm rather than /libm.so, why?

2019-06-17 Thread Alan W. Irwin

On Linux (Debian Testing) with CMake 3.13.2 (which I built myself)
I have a case where apparently

target_link_libraries(  /usr/lib/x86_64-linux-gnu/libm.so)

results in an actual link option "-lm".  Is this an exception to the
rule documented at

that if the full path is specified to target_link_libraries (as above)
that full path is used for the actual linking?

If so, I am curious about why this "CMake -lm exception" occurs and
are there other instances of such exceptions?  And shouldn't at least
the fact that there are still some exceptions be documented as part of
the CMP0060 documentation?

Note I discovered the above issue from a fairly short chain of
inference for the libLASi CMake-based build system, but if necessary,
I would be willing to attempt making a simple case demonstrating this
issue if it turns out that nobody here can verify it.

By the way, my use case is that some day I would likely to have the
option of building libLASi as static with *all* external libraries
static as well.  Of course, for that use case I could not use a
generic linking flag such as -lm which is why I am wondering
why "-lm" is being used for the actual link option above.

Alan
__
Alan W. Irwin

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.org); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__

Linux-powered Science
__
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers