View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008644CMakeModulespublic2009-02-28 18:082016-06-10 14:30
ReporterJohannes Wienke 
Assigned ToBill Hoffman 
PrioritynormalSeveritytweakReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0008644: Imcompatible output of pkg_check_modules for flags
DescriptionThe pkg_check_modules macro returns semicolon separated lists of flags. These lists cannot be directly used for any of the compiler flag varibale (e.g. in set_target_properties) because here a whitespace separated string is required. It would be much easier if the package config macro returns a string that can be used directly.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0017480)
Bill Hoffman (manager)
2009-09-14 15:24

But, that would make it harder to parse them and manipulate them in Cmake.
(0017482)
Johannes Wienke (reporter)
2009-09-14 15:36

Hm, that's true. What about providing two separate variables, one with the list as it is now and one that can be used as compiler flags? Or another solution would be to provide a macro that directly transforms the list into a string.
(0019505)
Igor Baldachini (reporter)
2010-02-10 05:01

In CMake FAQ there is:

  Why do I have unwanted semicolons ; in my compiler flags?

CMake has a list data type. A list is stored as a string of semicolon-separated list elements. Whitespace separated arguments to a SET statement are interpreted as list elements. For instance, SET(var a b c d e) will give "var" a value of a;b;c;d;e and this list can be used by other CMake commands. However, if you pass ${var} to a non-CMake external tool, such as a compiler's command line, you are passing a;b;c;d;e which is not what you want. Instead you either need to pass "${var}", so that the list will be converted to a whitespace-separated string, or you need to SET(var "a b c d e") in the 1st place so that you're working with a string, not a list.

Then I expect that:

pkg_check_modules(ELEMENTARY elementary)
message(${ELEMENTARY_CFLAGS})
message("${ELEMENTARY_CFLAGS}")

1. prints a list with semicolon -> message(${ELEMENTARY_CFLAGS})
2. prints a list with whitespace -> message("${ELEMENTARY_CFLAGS}")

But the output result is

1. a list without semicolon and without whitespace -> message(${ELEMENTARY_CFLAGS})
-I/usr/local/include-I/usr/local/include/elementary-I/usr/local/include/eina-0-I/usr/local/include/eina-0/eina-I/usr/include/glib-2.0-I/usr/lib/glib-2.0/include-I/usr/include/lua5.1-I/usr/include/freetype2

2. a list with semicolon -> message("${ELEMENTARY_CFLAGS}")
-I/usr/local/include;-I/usr/local/include/elementary;-I/usr/local/include/eina-0;-I/usr/local/include/eina-0/eina;-I/usr/include/glib-2.0;-I/usr/lib/glib-2.0/include;-I/usr/include/lua5.1;-I/usr/include/freetype2

So the conversion dos not take place and the use of variable without quotation marks removes the semi-colon.
(0041506)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2009-02-28 18:08 Johannes Wienke New Issue
2009-09-14 15:24 Bill Hoffman Note Added: 0017480
2009-09-14 15:24 Bill Hoffman Status new => assigned
2009-09-14 15:24 Bill Hoffman Assigned To => Bill Hoffman
2009-09-14 15:36 Johannes Wienke Note Added: 0017482
2010-02-10 05:01 Igor Baldachini Note Added: 0019505
2010-08-29 10:39 Kovarththanan Rajaratnam Category CMake => Modules
2016-06-10 14:27 Kitware Robot Note Added: 0041506
2016-06-10 14:27 Kitware Robot Status assigned => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team