Sign in to follow this  
gbozovic

cmake issue with qt_wrap_cpp

Recommended Posts

Hi all!

I currently have a big problem with a piece of soiftware that compiles with cmake. Since someone did a "port selfupdate", I get this error:

CMake Error at CMakeLists.txt:4 (INCLUDE):
include called with wrong number of arguments. Include only takes one
file.

CMake Error at CMakeLists.txt:6 (QT4_WRAP_CPP):
Unknown CMake command "QT4_WRAP_CPP".

The corresponding lines in my cmakelists.txt file are:

INCLUDE(${QT_USE_FILE})

QT4_WRAP_CPP(QTKPT_MOC_FILES glbox.h view.h stexture.h)

Now even back-up versions of the software ceased to compile, which makes me think that it's an update issue, more than a code issue.

Does anyone know what update can cause this behavior? And, better still, how to solve it without downgrading?

I'm very sorry if that's a trivial issue, but it has been keeping me stuck for a long time now :-S

Thanks in advance for all inputs!!

Share this post


Link to post
Share on other sites
Did you delete CMakeCache.txt and CMakeFiles/ when you switched back to your older version? Otherwise your CMakeCache might be already poisoned with the new unwanted changes.

Otherwise getting CMake working with QT4 can be a little bit daunting. Here is the cmake code that I am using and works well for me:

FIND_PACKAGE (Qt4 REQUIRED)

ADD_DEFINITIONS (${QT_DEFINITIONS})

SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTOPENGL TRUE )
SET( QT_WRAP_CPP TRUE )

INCLUDE (${QT_USE_FILE})

SET ( UI_sources
# all your .ui files
)

QT4_WRAP_UI ( UI_headers ${UI_sources})

SET ( App_sources
# all your .cpp files
)

QT4_WRAP_CPP ( MOC_headers
# all header files that need to be moc'ed
)

ADD_EXECUTABLE ( app_bin
${App_sources}
${MOC_headers}
${UI_headers}
)


Hope it helps.

Share this post


Link to post
Share on other sites
Quote:
Original post by fng
Did you delete CMakeCache.txt and CMakeFiles/ when you switched back to your older version? Otherwise your CMakeCache might be already poisoned with the new unwanted changes.

Otherwise getting CMake working with QT4 can be a little bit daunting. Here is the cmake code that I am using and works well for me:

*** Source Snippet Removed ***

Hope it helps.


set(QT_USE_QTXML true) needs to be set before you find_package(Qt4 REQUIRED)

Share this post


Link to post
Share on other sites
Quote:
Original post by SeaBourne
set(QT_USE_QTXML true) needs to be set before you find_package(Qt4 REQUIRED)

Yes! You are correct! Seems to me as if it is then not necessary in my case.

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this