[cmake-developers] [CMake 0013060]: FindQt4 relies on the command 'qmake -query QT_INSTALL_LIBS' to determine the lib path and ignores FIND_LIBRARY_USE_LIB64_PATHS

Mantis Bug Tracker mantis at public.kitware.com
Fri Mar 23 14:36:39 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13060 
====================================================================== 
Reported By:                Claus Christmann
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13060
Category:                   
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-03-23 14:36 EDT
Last Modified:              2012-03-23 14:36 EDT
====================================================================== 
Summary:                    FindQt4 relies on the command 'qmake -query
QT_INSTALL_LIBS' to determine the lib path and  ignores
FIND_LIBRARY_USE_LIB64_PATHS
Description: 
The FindQt4.cmake file which underlies find_package(Qt4) ignores the global
property FIND_LIBRARY_USE_LIB64_PATHS. It starts searching for the Qt4 libraries
with a HINT set to the output of an EXECUTE_PROCESS() call to 'qmake -query
QT_INSTALL_LIBS' which always only seems to return the location of the 64 bit
libraries (and plugins, and imports, and examples).

Steps to Reproduce: 
Simply run this CMakeLists.txt (also attached) and look at the output:

project(findqt4_test)
cmake_minimum_required(VERSION 2.8)

# being lazy 
macro( message_variable VAR_NAME )
  message(STATUS ${VAR_NAME}=${${VAR_NAME}})
endmacro( message_variable VAR_NAME )

# setting and checking the property
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
get_property(use_lib64_paths GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
message_variable(use_lib64_paths)

find_package(Qt4 REQUIRED)
include( ${QT_USE_FILE} )

message_variable(QT_BINARY_DIR)       # Path to "bin" of Qt4
message_variable(QT_LIBRARY_DIR)      # Path to "lib" of Qt4
message_variable(QT_PLUGINS_DIR)      # Path to "plugins" for Qt4
message_variable(QT_IMPORTS_DIR)      # Path to "imports" of Qt4

message_variable(QT_LIBRARIES)

Additional Information: 
I started messing with the FindQt4.cmake and wrapped the library finding part in
a big IF() ENDIF() on the propery FIND_LIBRARY_USE_LIB64_PATHS and that worked.
However, I then realized that I also would have to do that for the plugins and
imports.

As I realize that FIND_LIBRARY_USE_LIB64_PATHS actually should effect something
inside the FIND_LIBRARY() calls, my workaround clearly started from a wrong
approach. However, as FindQt4 is written in a way which doesn't seem to allow to
use the property inside the FIND_LIBRARY() calls (it sets a HINT and at the same
time NO_DEFAULT_PATHS), my wrapper seemed to circumvent this.

Bottom line: I just don't know enough cmake to fix this "the right way", hence I
am just reporting this without also submitting a patch.


PS: As an aside note, I found that my distro (openSuSE 12.1 x86_64) doesn't set
non-versioned symlinks for the 32bit libraries of qt, i.e. /usr/lib only
contains libQt*.so.4 symlinks and no libQt*.so ones. I had to create those by
hand so that find_library(QtCore) would actually return a result from the
non-lib64 path.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-03-23 14:36 Claus ChristmannNew Issue                                    
2012-03-23 14:36 Claus ChristmannFile Added: CMakeLists.txt                    
======================================================================




More information about the cmake-developers mailing list