[cmake-developers] [CMake 0014535]: Definitions Not Defined In Qt Automoc

Mantis Bug Tracker mantis at public.kitware.com
Thu Oct 31 14:47:06 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14535 
====================================================================== 
Reported By:                Janne Rönkkö
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14535
Category:                   (No Category)
Reproducibility:            have not tried
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-10-31 14:47 EDT
Last Modified:              2013-10-31 14:47 EDT
====================================================================== 
Summary:                    Definitions Not Defined In Qt Automoc
Description: 
With CMake 2.8.12 (and with tested git version from commit
8a6e82724c42920855c2348e914636f52a0c55d5) automoc does not set definitions for
moc properly.

With CMake 2.8.11.2 this problem does not exist.

I have created example project that demonstrates the issue.

With CMake 2.8.12 (or with the git version I tried) the plugin is not created
properly because QT5 define is not set while moc runs.

Steps to Reproduce: 
$ tar xf example.tar.gz 
$ mkdir example/build
$ cd example/build

$ cmake --version
cmake version 2.8.11.2

$ cmake .. -DUSE_AUTOMOC=false
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
...
-- Found Qt4: /usr/bin/qmake-qt4 (found version "4.8.5") 
Not using automoc
MocSrc /home/janne/tmp/example/build/moc_PluginImpl.cxx
-- Configuring done
-- Generating done
-- Build files have been written to: /home/janne/tmp/example/build

$ make

$ ./loadplugin libtestplugin.so 
Loading plugin from "libtestplugin.so" 
fileName(): "/home/janne/tmp/example/build/libtestplugin.so" 
isLoaded(): false 
err: "Unknown error" 
Success!

$ cmake .. -DUSE_AUTOMOC=true
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
...
-- Found Qt4: /usr/bin/qmake-qt4 (found version "4.8.5") 
Using automoc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/janne/tmp/example/build

$ make                                                                          
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
$ ./loadplugin libtestplugin.so                                                 
                                                                                
                                                                                
                            
Loading plugin from "libtestplugin.so"                                          
                                                                                
                                                                                
                            
fileName(): "/home/janne/tmp/example/build/libtestplugin.so"                    
                                                                                
                                                                                
                            
isLoaded(): false                                                               
                                                                                
                                                                                
                            
err: "Unknown error"                                                            
                                                                                
                                                                                
                            
Success!                                                                        
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
$ cmake --version                                                               
                                                                                
                                                                                
                            
cmake version 2.8.12                                                            
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
$ cmake .. -DUSE_AUTOMOC=false                                                  
                                                                                
                                                                                
                            
-- The C compiler identification is GNU 4.8.2                                   
                                                                                
                                                                                
                            
-- The CXX compiler identification is GNU 4.8.2                                 
                                                                                
                                                                                
                            
-- Found Qt4: /usr/bin/qmake-qt4 (found version "4.8.5")                        
                                                                                
                                                                                
                            
Not using automoc                                                               
                                                                                
                                                                                
                            
MocSrc /home/janne/tmp/example/build/moc_PluginImpl.cxx                         
                                                                                
                                                                                
                            
-- Configuring done                                                             
                                                                                
                                                                                
                            
-- Generating done                                                              
                                                                                
                                                                                
                            
-- Build files have been written to: /home/janne/tmp/example/build              
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
$ make                                                                          
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
$ ./loadplugin libtestplugin.so                                                 
                                                                                
                                                                                
                            
Loading plugin from "libtestplugin.so"                                          
                                                                                
                                                                                
                            
fileName(): "/home/janne/tmp/example/build/libtestplugin.so"                    
                                                                                
                                                                                
                            
isLoaded(): false                                                               
                                                                                
                                                                                
                            
err: "Unknown error"                                                            
                                                                                
                                                                                
                            
Success!                                                                        
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
$ cmake .. -DUSE_AUTOMOC=true                                                   
                                                                                
                                                                                
                            
-- The C compiler identification is GNU 4.8.2                                   
                                                                                
                                                                                
                            
-- The CXX compiler identification is GNU 4.8.2                                 
                                                                                
                                                                                
                            
-- Found Qt4: /usr/bin/qmake-qt4 (found version "4.8.5")                        
                                                                                
                                                                                
                            
Using automoc                                                                   
                                                                                
                                                                                
                            
-- Configuring done                                                             
                                                                                
                                                                                
                            
-- Generating done                                                              
                                                                                
                                                                                
                            
-- Build files have been written to: /home/janne/tmp/example/build              
                                                                                
                                                                                
                            
                                                                                
                                                                                
                                                                                
                            
$ make                                                                          
                                                                                
                                                                                
                            

$ ./loadplugin libtestplugin.so 
Loading plugin from "libtestplugin.so" 
fileName(): "/home/janne/tmp/example/build/libtestplugin.so" 
isLoaded(): false 
err: "Unknown error" 
!! No plugin found.

Additional Information: 
The issue exists with Qt4 and Qt5.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-10-31 14:47 Janne Rönkkö   New Issue                                    
2013-10-31 14:47 Janne Rönkkö   File Added: example.tar.gz                    
======================================================================




More information about the cmake-developers mailing list