View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0012317 | CMake | CMake | public | 2011-07-05 19:11 | 2016-06-10 14:31 | ||||
Reporter | Aaron Simmons | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | high | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Unix | OS | Ubuntu | OS Version | 11.04 | ||||
Product Version | CMake 2.8.4 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0012317: pkg_check_modules produces output incompatible with other cmake variables | ||||||||
Description | Using pkg_check_modules outputs XXX_LDFLAGS as a list (semi-colon delimited) whereas CMAKE_EXE_LINKER_FLAGS requires a flat space-delimited string. | ||||||||
Steps To Reproduce | Run this code on Ubuntu 11.04: # setup glib2 pkg_check_modules(GLIB2 REQUIRED glib-2.0) message("GLIB2_LDFLAGS= ${GLIB2_LDFLAGS}") add_definitions(${GLIB2_CFLAGS} ${GLIB2_CFLAGS_OTHER}) set( CMAKE_EXE_LINKER_FLAGS ${GLIB2_LDFLAGS}) This will output: GLIB2_LDFLAGS= -L/usr/lib/i386-linux-gnu;-lglib-2.0 which when put into CMAKE_EXE_LINKER_FLAGS, will create invalid flags for gcc-- it will literally emit "-L/usr/lib/i386-linux-gnu;-lglib-2.0" to the command-line. | ||||||||
Additional Information | It's unclear how pkg_check_modules is intended to be used-- are we supposed to write custom code transform its output? Why? | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0027012) Alex Neundorf (developer) 2011-07-06 12:04 |
That's a weakness of pkg-config, if you want to use it in cmake basically you have to deal with it. What I usually recommend: use the results of pkg-config as HINTS to find_path() and find_library(), so if pkg-config has found the package, the dirs it reported will be checked first by find_library() and find_path(). If pkg-config has not found the package, cmake may still find it. This also makes sure that the cmake code will also work on systems without pkg-config or where it is not properly set up. I.e. something like: FIND_PACKAGE(PkgConfig) PKG_CHECK_MODULES(PC_LIBXML libxml-2.0 QUIET) SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h HINTS ${PC_LIBXML_INCLUDEDIR} ${PC_LIBXML_INCLUDE_DIRS} PATH_SUFFIXES libxml2 ) FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 HINTS ${PC_LIBXML_LIBDIR} ${PC_LIBXML_LIBRARY_DIRS} ) |
(0030275) David Cole (manager) 2012-08-11 11:38 |
Sending old, never assigned issues to the backlog. (The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...) If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^] It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing. |
(0039408) Dan Kegel (reporter) 2015-09-11 18:06 edited on: 2015-09-11 18:07 |
You have to fix the list separator. It's rather painful. e.g.: pkg_check_modules(GSTREAMER gstreamer-1.0) # Ah, cmake, gotta love your list separator. STRING(REPLACE ";" " " GSTREAMER_CFLAGS_STRING "${GSTREAMER_CFLAGS}") STRING(REPLACE ";" " " GSTREAMER_LDFLAGS_STRING "${GSTREAMER_LDFLAGS}") pkg_check_modules(GSTREAMER_APP REQUIRED gstreamer-app-1.0) STRING(REPLACE ";" " " GSTREAMER_APP_CFLAGS_STRING "${GSTREAMER_APP_CFLAGS}") STRING(REPLACE ";" " " GSTREAMER_APP_LDFLAGS_STRING "${GSTREAMER_APP_LDFLAGS}") ... That undoes some of the brain damage. Woe until you if a library has a space in a filename, though! |
(0041857) Kitware Robot (administrator) 2016-06-10 14:28 |
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. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2011-07-05 19:11 | Aaron Simmons | New Issue | |
2011-07-06 12:04 | Alex Neundorf | Note Added: 0027012 | |
2012-08-11 11:38 | David Cole | Status | new => backlog |
2012-08-11 11:38 | David Cole | Note Added: 0030275 | |
2015-09-11 18:06 | Dan Kegel | Note Added: 0039408 | |
2015-09-11 18:07 | Dan Kegel | Note Edited: 0039408 | |
2016-06-10 14:28 | Kitware Robot | Note Added: 0041857 | |
2016-06-10 14:28 | Kitware Robot | Status | backlog => resolved |
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |