[CMake] how to get cmake and custom qt widget to work?

NoRulez norulez at me.com
Tue Oct 5 15:32:13 EDT 2010


I don't know about a qstringspinbox, did you mean QSpinBox instead?

Am 05.10.2010 um 21:15 schrieb "eial at cs.bgu.ac.il" <eial at cs.bgu.ac.il>:

> 
> probably, here is the gui libs CMakeList.txt:
> 
> #get all cpp files in libs
> FILE(GLOB GUI_CPP *.cpp)
> FILE(GLOB GUI_HPP *.hpp)
> FILE(GLOB GUI_UI *.ui)
> 
> SET(QT_USE_QTGUI TRUE)
> 
> #splice out all non UI headers, still in testing, currently disabled.
> SET (SPLICED_GUI_HPP "")
> foreach (SITEM ${GUI_HPP})
>  set (FILECONTENT "")
>  FILE (READ ${SITEM} FILECONTENT)
>  set (VAL "")
>  STRING(REGEX MATCH "Q_OBJECT" VAL ${FILECONTENT})
>  if (VAL)
>    LIST (APPEND SPLICED_GUI_HPP ${SITEM})
>  endif (VAL)
> endforeach(SITEM ${GUI_HPP})
> 
> QT4_WRAP_UI(GUI_UI_H ${GUI_UI})
> QT4_WRAP_CPP(GUI_MOC_SRCS ${SPLICED_GUI_HPP})
> 
> #build a shared library
> ADD_LIBRARY(GUI SHARED ${GUI_CPP} ${GUI_MOC_SRCS} ${GUI_UI_H})
> 
> #link libs
> TARGET_LINK_LIBRARIES(GUI ${QT_QTCORE_LIBRARIES} ${QT_QTGUI_LIBRARIES} Utilities DataObjects)
> 
> and project's CMakeList.txt:
> 
> CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
> PROJECT(ossm)
> 
> SET(CMAKE_VERBOSE_MAKEFILE ON)
> SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build)
> SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/libs)
> SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/modules)
> SET(Boost_MINIMUM_VERSION "1.37")
> 
> include(CheckCXXCompilerFlag)
> 
> CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_NEW_ISO_STD)
> IF(COMPILER_SUPPORTS_NEW_ISO_STD)
>  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
>  MESSAGE(STATUS "  Found c++0x support")
> ELSE(COMPILER_SUPPORTS_NEW_ISO_STD)
>  MESSAGE(SEND_ERROR "  no c++0x support found, this program must be compiled with c++0x support.")
> ENDIF(COMPILER_SUPPORTS_NEW_ISO_STD)
> 
> FIND_PACKAGE(Boost 1.37.0 COMPONENTS thread-mt unit_test_framework-mt iostreams-mt filesystem-mt REQUIRED)
> FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml REQUIRED)
> FIND_PACKAGE(LibLZMA REQUIRED)
> 
> INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR} ${QT_INCLUDE_DIR} ${LIBLZMA_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/src src)
> 
> SUBDIRS(src)
> 
> 
> On Tue 05 Oct 21:02 2010 John Drescher wrote:
>> On Tue, Oct 5, 2010 at 2:59 PM, eial at cs.bgu.ac.il <eial at cs.bgu.ac.il> wrote:
>>> 
>>> hello.
>>> I have a cmake+qt4 project, I needed to extend a certain gui item to suit my needs, I've been able to insert it into qtcreator and incorporate it into the project's gui, now when I run compilation, I get this:
>>> /home/dagg/workspace/OSSM/src/GUI/ui_TrainingActivityManager.h:29:28: error: qstringspinbox.h: No such file or directory
>>> 
>>> the relevant part of /home/dagg/workspace/OSSM/src/GUI/ui_TrainingActivityManager.h is this:
>>> /********************************************************************************
>>> ** Form generated from reading UI file 'TrainingActivityManager.ui'
>>> **
>>> ** Created: Tue Oct 5 20:29:00 2010
>>> **      by: Qt User Interface Compiler version 4.6.3
>>> **
>>> ** WARNING! All changes made in this file will be lost when recompiling UI file!
>>> ********************************************************************************/
>>> 
>>> #ifndef UI_TRAININGACTIVITYMANAGER_H
>>> #define UI_TRAININGACTIVITYMANAGER_H
>>> 
>>> #include <QtCore/QLocale>
>>> #include <QtCore/QVariant>
>>> #include <QtGui/QAction>
>>> #include <QtGui/QApplication>
>>> #include <QtGui/QButtonGroup>
>>> #include <QtGui/QDialog>
>>> #include <QtGui/QDialogButtonBox>
>>> #include <QtGui/QFormLayout>
>>> #include <QtGui/QGridLayout>
>>> #include <QtGui/QHeaderView>
>>> #include <QtGui/QLabel>
>>> #include <QtGui/QLineEdit>
>>> #include <QtGui/QPushButton>
>>> #include <QtGui/QTreeWidget>
>>> #include <QtGui/QVBoxLayout>
>>> #include <QtGui/QWidget>
>>> #include <qstringspinbox.h>  // line 28
>>> 
>>> QT_BEGIN_NAMESPACE
>>> 
>>> class Ui_TrainingActivityManager
>>> {
>>> public:
>>>    QTreeWidget *mTrainActManList;
>>>    QWidget *layoutWidget;
>>> 
>>> how can I make cmake work with this plugin, I've putted the hpp and cpp of the plugin within one of my sub project's src folder, also the file is called qstringspinbox.hpp.
>>> 
>>> any help would be appreciated.
>>> 
>> The problem is most likely with your CMakeLists.txt
>> 
>> John
>> 
> 
> 
> 
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list