[CMake] Qt3

Filipe Sousa filipe at ipb.pt
Wed Jul 27 11:05:14 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

olivier.stern at swing.be wrote:
> 
> 
> Hi,
> 
> As I must use Qt 3 in a program with libraries using cmake to produce a
> makefile, I try to generate a makefile with a simple Qt3 projet. Here is
> the project:
> 
> http://www.digitalfanatics.org/projects/qt_tutorial/fr/chapter05.html
> 
> At the end of it, I ve got 4 files: simple-dialog.pro, main.cpp,
> dlgmain.ui.h and dlgmain.ui.
> I've wrote here a time ago but I had troubles with libraries and didn't
> continue...
> 
> Here is the CMakeLists.txt advised:
> 
> FIND_PACKAGE(Qt)
> 
> ADD_DEFINITIONS(${QT_DEFINITIONS})
> INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
> 
> QT_WRAP_CPP(qtwrapping moc_sources dlgmain.ui.h)
> QT_WRAP_UI(qtwrapping headers sources dlgmain.ui)
> ADD_EXECUTABLE(qtwrapping main.cpp ${moc_sources} ${headers} ${sources})
> TARGET_LINK_LIBRARIES(qtwrapping ${QT_LIBRARIES})
> 
> When I try to configure with ccmake, here the error which appears:
> 
> CMake Error: Attempt to add a custom rul! e to output
> \"/home/olivier/Projets/Tfe/Qt-gcc/moc_dlgmain.cxx\" which already has
> a custom rule.
> 
> Does anyone had this problem ?
> Thx,
> Olivier

The problem is that both QT_WRAP_CPP and QT_WRAP_UI generates the file
moc_dlgmain.cxx. QT_WRAP_CPP should generate the file moc_dlgmain.ui.cxx
instead of moc_dlgmain.cxx

I attached a simple fix to cmQTWrapCPPCommand.cxx

- -- Filipe Sousa




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC56KqbQdNYqwwwCwRAlW/AKCxj52aX4AZgDZGWRf6K5lM0yifcQCgsY+c
Ldsr7YeAY3SWVKrUAdBAcsY=
=ttwM
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: cmQTWrapCPPCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmQTWrapCPPCommand.cxx,v
retrieving revision 1.19
diff -u -3 -p -r1.19 cmQTWrapCPPCommand.cxx
--- cmQTWrapCPPCommand.cxx	22 Feb 2005 15:32:43 -0000	1.19
+++ cmQTWrapCPPCommand.cxx	27 Jul 2005 14:57:53 -0000
@@ -57,7 +57,7 @@ bool cmQTWrapCPPCommand::InitialPass(std
         {
         file.SetProperty("ABSTRACT",curr->GetProperty("ABSTRACT"));
         }
-      std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
+      std::string srcName = cmSystemTools::GetFilenameWithoutLastExtension(*j);
       std::string newName = "moc_" + srcName;
       file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
                    "cxx",false);


More information about the CMake mailing list