The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15608 
====================================================================== 
Reported By:                Hendrik Sattler
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15608
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-06-11 02:14 EDT
Last Modified:              2015-06-11 02:14 EDT
====================================================================== 
Summary:                    automoc fails when enabling autorcc
Description: 
Automoc does not work after initial cmake run when autorcc is enabled.

I created a small example that shows the problem. I created it from
scratch and it instantly fails for me. I get:
error C3861: 'onTst2': identifier not found (moc_main.cpp)

This file is auto-generated and thus was not updated. -> Should not
happen.

I also tried to manually run cmake, it won't help. However, commenting mainx.qrc
helps! Or using qt4_add_resources() and disabling CMAKE_AUTORCC!

Suddenly, the bugtest_automoc target is gone in VS and it compiles
again, even after adding/removing Qt slot functions.
BTW, why is this target called bugtest_automoc and not bugtest_autogen?

The whole thing looks strange as bugtest target still has a
qrc_mainx.cpp.rule but bugtest_automoc also has such a rule.
The bugtest.automoc.rule file properties show no real command:
-----------------
setlocal
cd D:\bugtest\cmake-autogen\build
if %errorlevel% neq 0 goto :cmEnd
D:
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
-----------------
Is that supposed to actually do something?

I am using Visual Studio 2010. CMake is 3.2.2 but also I tried 3.3-rc1.



Steps to Reproduce: 
You need to create a foo.png to get the qrc to actually create the
source file (actually 2nd bug that CMake doesn't warn about a missing file).

First run, comment out the onTst2 slot function (both h and cpp file),
it should build.
Then comment it before 2nd run.


Additional Information: 
CMakeLists.txt:
----------------------------------------------
cmake_minimum_required ( VERSION 3.0.2 )
cmake_policy ( VERSION 3.0.2 )

project ( bugtest CXX )

find_package ( Qt4 )

set ( CMAKE_INCLUDE_CURRENT_DIR ON )
set ( CMAKE_AUTOMOC ON )
set ( CMAKE_AUTORCC ON )

add_executable ( bugtest
  main.cpp
  mainx.qrc
)
target_link_libraries ( bugtest Qt4::QtCore )
----------------------------------------------

main.h:
----------------------------------------------
#include <QObject>

class tst1 : public QObject
{
  Q_OBJECT

 public slots:
   void onTst1();
   //void onTst2();
};
----------------------------------------------

main.cpp:
----------------------------------------------
#include "main.h"

void tst1::onTst1()
{
}

// void tst1::onTst2()
// {
// }

int main( int argc, char **argv)
{
  return 0;
}
----------------------------------------------

mainx.qrc:
----------------------------------------------
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
  <file>foo.png</file>
</qresource>
</RCC>
----------------------------------------------

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-06-11 02:14 Hendrik SattlerNew Issue                                    
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to