[CMake] Bug in TARGET_LINK_LIBRARIES

Filipe Sousa filipe at ipb.pt
Fri Feb 10 10:05:55 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Neundorf wrote:
>> Von: Filipe Sousa <filipe at ipb.pt> 
>>
>> Hi 
>>  
>> PROJECT(math) 
>> ADD_EXECUTABLE(math math.c) 
>> TARGET_LINK_LIBRARIES(math m z) 
>>  
>> Linking C executable math 
>> /usr/local/bin/cmake -E remove -f math 
>> /usr/bin/gcc     -fPIC "CMakeFiles/math.dir/math.o"   -o math -rdynamic 
>>  
>> TARGET_LINK_LIBRARIES is ignoring library m and z, in fact 
>> TARGET_LINK_LIBRARIES is ignoring all libraries with one char. 
>  
> I can acknowledge this. I saw the same effect, but thought that I did 
> somethine wrong and didn't investigate further. 
> cvs from some days ago. 
>  
> Alex 

The problem is in cmLocalGenerator::ComputeLinkInformation()

    // For backwards compatibility variables may have been expanded
    // inside library names.  Clean up the resulting name.
    std::string lib = j->first;
    std::string::size_type pos = lib.find_first_not_of(" \t\r\n");
    if(pos != lib.npos)
      {
      lib = lib.substr(pos, lib.npos);
      }
    pos = lib.find_last_not_of(" \t\r\n");
    if(pos != lib.npos)
      {
      lib = lib.substr(0, pos);
	//** this code always eats the fist char **
      }
    if(lib.empty())
      {
      continue;
      }

- --
Filipe Sousa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD7KvTbQdNYqwwwCwRAh88AJ9yAtzYKJpFsDZKieOv2T5Li7NsWACdHpgU
jFuzTJSTzts1d/9BVZib3jo=
=SgiN
-----END PGP SIGNATURE-----


More information about the CMake mailing list