[CMake] Magical transformation of /path/to/libmylib.so to -lmylib
Michael Hertling
mhertling at online.de
Mon Jul 11 19:46:01 EDT 2011
On 07/11/2011 11:34 PM, Jens Mueller wrote:
> Hi,
>
> I'm trying to figure out where the path for a found library is changed.
> In my case Curses is found at /usr/lib/libcurses.so. When linking with
> gcc "/usr/lib/libcurses.so" is replaced by "-lcurses" as it is specified
> at http://www.cmake.org/Wiki/CMake_2.6_Notes#Linking_to_System_Libraries.
> Where can I find the code that causes these changes? I looked into
> share/Modules/ at various CMake* files but I'm unable find the code.
>
> Jens
The system directories are identified during the initial detection
of the compiler ABI ("Detecting <LANG> compiler ABI info"), see
Modules/CMakeDetermineCompilerABI.cmake
Modules/CMakeParseImplicitLinkInfo.cmake
w.r.t. the CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES variables.
AFAIK, the actual conversion of the full path to a -l option
is performed in Source/cmComputeLinkInformation.cxx by:
cmComputeLinkInformation::AddFullItem()
cmComputeLinkInformation::CheckImplicitDirItem()
cmComputeLinkInformation::AddUserItem()
Previously, the underlying cmComputeLinkInformation::ImplicitLinkDirs
set is populated by cmComputeLinkInformation::LoadImplicitLinkInfo()
from the CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES variables' contents.
Regards,
Michael
More information about the CMake
mailing list