[CMake] string(TOUPPER ...) problems

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Aug 14 13:38:50 EDT 2007


On 2007-08-14 19:17+0200 ope wrote:

> Hi,
>
> I get the error
>
> CMake Error: Error in cmake code at
> .../CMakeLists.txt:295:
> STRING no output variable specified
>
> by this peace of code:
>
>
> set (requiredPackages
>  ZLIB
>  BZip2
>  XercesC
>  CURL
>  Log4cxx
> )
>
> 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()
>
> Imo there is an output variable of course. Anyway, I have to work around
> the upper/lower case depencies from FindXXX naming ...
>
> How to solve this?

I find the most useful (only?) way to debug CMake scripts is to use
MESSAGE(...) to print out intermediate results such as
${${package}_LIBRARIES}.  Once you do that, my guess is you will find that
variable does not exist for some/all of your packages so that the effective
command was string(TOUPPER PACKAGE_LIBRARIES) leading to the error message
you obtained.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.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
__________________________


More information about the CMake mailing list