[CMake] string(TOUPPER ...) problems

ope ope-devel at gmx.de
Tue Aug 14 13:50:27 EDT 2007


Thanks for all answers,

>> foreach (package ${requiredPackages})
>>   find_package(${package} REQUIRED)
>>   include_directories(${${package}_INCLUDE_DIRS})
>>   string(TOUPPER ${${package}_LIBRARIES} PACKAGE_LIBRARIES)
>>   link_directories(${PACKAGE_LIBRARIES})
>>   target_link_libraries(${app_name} ${PACKAGE_LIBRARIES})
>> endforeach()
> 
> I guess not in every iteration of the loop ${${package}_LIBRARIES} will be 
> empty. Putting quotes around it should help.

This works. Unfortunately the linker get erros now:

make[2]: *** No rule to make target `/USR/LIB/LIBZ.SO', needed by
`bin/App'.  Stop.

Well, obviously this approach doesn't work. If I use directly
${${package}_LIBRARIES} inside target_link_libraries() these
(lower/mixed case) libraries are not linked (linker error about
unresolved symbols); the parameters for the compiler/linker are missing
(e.g. g++ -lxerces-c doesn't exist).

> Remove the link_directories(), this is completely handled by 
> target_link_libraries().

Cool.


Thanks,
Olaf

PS: The mailing list manager should fill the reply-to email attribute to
cmake at cmake.org and not to the origin/sender of the email.



More information about the CMake mailing list