[CMake] Imported libraries lookup

Sergey Rudchenko sergey.rudchenko at gmail.com
Wed Apr 15 12:47:07 EDT 2009


Hi all,

My global generator adds some imported libraries in EnableLanguage 
method, but the TARGET_LINK_LIBRARIES command doesn't obey that fact the 
libraries are imported.
Here is the code which adds an imported library:

void cmGlobalSymbianMmpGenerator
::EnableLanguage(std::vector<std::string>const& languages,
                 cmMakefile* mf, bool optional)
{
    ...
    cmTarget* tgt = mf->AddImportedTarget(targetName.c_str(), 
cmTarget::SHARED_LIBRARY);
    tgt->SetProperty("IMPORTED_IMPLIB", importedImplib.c_str());
}

CMakeLists.txt:
add_executable(test test.cpp)
target_link_libraries(test euser)

I expected to know in my local generator whether the library is shared 
or not, but currently cmTarget::GetLinkLibraries() gives me 
cmTarget::GENERAL there.

My observations:
cmTargetLinkLibraries doesn't lookup linked library name in the imported 
targets, so it assumes it's link type is cmTarget::GENERAL.

cmMakefile::AddImportedTarget() creates a new target object in the 
cmMakefile::ImportedTargets container, but 
cmMakefile::AddLinkLibraryForTarget (TARGET_LINK_LIBRARIES essential) 
does not lookup lib name in that container too.

I am working in the 2.6.2 source tree.
Please, help me to understand where am I wrong.

--
Best regards,
Sergey Rudchenko


More information about the CMake mailing list