Package: cmake
Version: 2.8.12-2
Severity: important

After upgrading from cmake 2.8.11.2-1 to 2.8.12-2 automoc has stopped using the 
definitions added with ADD_DEFINITION. Consider for example the following 
situation:

CMakeLists.txt
----------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)

PROJECT(TestAutomoc)

SET(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(CMAKE_AUTOMOC ON)
FIND_PACKAGE(Qt5Core  REQUIRED)

FILE(GLOB SRCS ./*.cpp)
FILE(GLOB HDRS ./*.h)

ADD_DEFINITIONS("-DDEFINE_CLASS")

ADD_EXECUTABLE(testAutomoc ${SRCS} ${HDRS})
QT5_USE_MODULES(testAutomoc Core)
----------------------------------------------------

main.cpp
----------------------------------------------------
#include <QObject>

#ifdef DEFINE_CLASS
class Test : public QObject
{
        Q_OBJECT
};
#endif

int main()
{
        Test* t = new Test();

        delete t;

        return 0;
}

#include "main.moc"
----------------------------------------------------

This compiles fine with cmake 2.8.11.2-1 while it fails to compile with cmake 
2.8.12-2 with the following output:

[ 33%] Automoc for target testAutomoc
Generating main.moc
/home/tommy/Projects/Work/testAutomoc/main.cpp:0: Note: No relevant classes 
found. No output generated.
[ 33%] Built target testAutomoc_automoc
Scanning dependencies of target testAutomoc
[ 66%] Building CXX object CMakeFiles/testAutomoc.dir/main.cpp.o
[100%] Building CXX object CMakeFiles/testAutomoc.dir/testAutomoc_automoc.cpp.o
Linking CXX executable testAutomoc
CMakeFiles/testAutomoc.dir/main.cpp.o: In function `Test::Test()':
/home/tommy/Projects/Work/testAutomoc/main.cpp:4: undefined reference to 
`vtable for Test'
collect2: error: ld returned 1 exit status
make[2]: *** [testAutomoc] Error 1
make[1]: *** [CMakeFiles/testAutomoc.dir/all] Error 2
make: *** [all] Error 2

The moc command line is the following (obtained with make VERBOSE=1):

/usr/lib/x86_64-linux-gnu/qt5/bin/moc 
-I/home/tommy/Projects/Work/testAutomoc/build 
-I/home/tommy/Projects/Work/testAutomoc -I/usr/include/qt5 
-I/usr/include/qt5/QtCore -I/usr/share/qt5/mkspecs/linux-g++-64 -DQT_CORE_LIB 
-o /home/tommy/Projects/Work/testAutomoc/build/main.moc 
/home/tommy/Projects/Work/testAutomoc/main.cpp 

which lacks -DDEFINE_CLASS. When using make 2.8.11-2 the moc command line is 
this one:

/usr/lib/x86_64-linux-gnu/qt5/bin/moc 
-I/home/tommy/Projects/Work/testAutomoc/build 
-I/home/tommy/Projects/Work/testAutomoc -I/usr/include/qt5 
-I/usr/include/qt5/QtCore -I/usr/share/qt5/mkspecs/linux-g++-64 -DQT_CORE_LIB 
-DQT_CORE_LIB -DQT_NO_DEBUG -DDEFINE_CLASS -o 
/home/tommy/Projects/Work/testAutomoc/build/main.moc 
/home/tommy/Projects/Work/testAutomoc/main.cpp

Thanks for the help,
        Tomassino


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.11-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages cmake depends on:
ii  cmake-data    2.8.12-2
ii  libarchive13  3.1.2-7
ii  libc6         2.17-93
ii  libcurl3      7.33.0-1
ii  libexpat1     2.1.0-4
ii  libgcc1       1:4.8.2-1
ii  libstdc++6    4.8.2-1
ii  procps        1:3.3.8-2
ii  zlib1g        1:1.2.8.dfsg-1

Versions of packages cmake recommends:
ii  gcc   4:4.8.1-3
ii  make  3.81-8.3

Versions of packages cmake suggests:
pn  codeblocks  <none>
pn  eclipse     <none>

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to