[cmake-developers] [CMake 0013499]: CMake AUTOMOC creates empty .moc files.

Mantis Bug Tracker mantis at public.kitware.com
Thu Aug 30 12:55:57 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13499 
====================================================================== 
Reported By:                Stephen Kelly
Assigned To:                Alex Neundorf
====================================================================== 
Project:                    CMake
Issue ID:                   13499
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             2012-08-30 12:55 EDT
Last Modified:              2012-08-30 12:55 EDT
====================================================================== 
Summary:                    CMake AUTOMOC creates empty .moc files.
Description: 
With a simple hello world application automoc is generating empty .moc files:


stephen at hal:~/dev/src/playground/cmake/native{master}$ make
makeobj[0]: Entering directory `/home/stephen/dev/src/playground/cmake/native'
Scanning dependencies of target helloworld_automoc
[ 25%] Automoc for target helloworld
Generating mainwindow.moc
/home/stephen/dev/src/playground/cmake/mainwindow.cpp:8: Note: No relevant
classes found. No output generated.
Generating moc_mainwindow.cpp
[ 25%] Built target helloworld_automoc
Scanning dependencies of target helloworld
[ 50%] [ 75%] [100%] Building CXX object CMakeFiles/helloworld.dir/main.cpp.o
Building CXX object CMakeFiles/helloworld.dir/mainwindow.cpp.o
Building CXX object CMakeFiles/helloworld.dir/helloworld_automoc.cpp.o
Linking CXX executable helloworld
[100%] Built target helloworld
makeobj[0]: Leaving directory `/home/stephen/dev/src/playground/cmake/native'
stephen at hal:~/dev/src/playground/cmake/native{master}$ l
CMakeCache.txt  CMakeFiles/  cmake_install.cmake  helloworld* 
helloworld_automoc.cpp  mainwindow.moc  Makefile  moc_mainwindow.cpp
stephen at hal:~/dev/src/playground/cmake/native{master}$ wc mainwindow.moc
moc_mainwindow.cpp 
   0    0    0 mainwindow.moc
  81  242 2351 moc_mainwindow.cpp
  81  242 2351 total

 
stephen at hal:~/dev/src/playground/cmake/native{master}$ cat ../main.cpp

#include <QApplication>
#include "mainwindow.h"

int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    MainWindow mw;
    mw.show();

    return app.exec();
}

stephen at hal:~/dev/src/playground/cmake/native{master}$ cat ../mainwindow.cpp


#include "mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
{

}

#include "mainwindow.moc"

stephen at hal:~/dev/src/playground/cmake/native{master}$ cat ../mainwindow.h

#include <QWidget>

class MainWindow : public QWidget
{
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
};

stephen at hal:~/dev/src/playground/cmake/native{master}$ cat ../CMakeLists.txt

cmake_minimum_required(VERSION 2.8)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

find_package(Qt4 REQUIRED)

include_directories(${QT_INCLUDES})

add_executable(helloworld
    main.cpp
    mainwindow.cpp
)
target_link_libraries(helloworld ${QT_QTGUI_LIBRARIES} ${QT_QTCORE_LIBRARIES})

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-08-30 12:55 Stephen Kelly  New Issue                                    
2012-08-30 12:55 Stephen Kelly  Status                   new => assigned     
2012-08-30 12:55 Stephen Kelly  Assigned To               => Alex Neundorf   
======================================================================




More information about the cmake-developers mailing list