[CMake] Problem with QT3 not generating .cpp files using Cmake

Darrell Langford darrell.langford at yahoo.com
Tue Oct 11 11:46:40 EDT 2011


Okay, the problem I am having is as follows.  I am converting a C++ QT3 program over from using qmake to cmake and have hit a snag.

The following is my basic layout for the cmakelists.txt file, what happens is, when the UIC command gets called from the QT_WRAP_UI it doesn't generate out .cpp files, just the .h files.

In qmake for qt3, every .ui file when it goes through UIC gets it's own .h and .cpp file, and the .ui.h is your own implementation of some of the functions.  So Although everything builds, when it hits time to link, it has tons of undefined references to itself, because the actual implementations never got generated.

Any help or suggestions would be greatly appreciated.

CMakeLists.txt
#**************************************************
# Find QT

FIND_PACKAGE(Qt3 REQUIRED)

ADD_DEFINITIONS(${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}

        ${CMAKE_CURRENT_SRC_DIR})

SET(SAMPLE_SOURCES main.cpp 
Sample.cpp
UIImpl.cpp )

SET(SAMPLE_HEADERS UIImpl.h 
           Sample.h )

SET(SAMPLE_HEADERS_UI_H SampleControl.ui.h 
           SampleControl2.ui.h)


SET(SAMPLE_FORMS SampleControl.ui 
              SampleControl2.ui )

QT_WRAP_UI(SAMPLEAPP SAMPLE_FORMS_H SAMPLE_FORMS_CPP ${SAMPLE_FORMS})
QT_WRAP_CPP(SAMPLEAPP SAMPLE_HEADERS_MOC ${SAMPLE_HEADERS} ${SAMPLE_FORMS_H})




link_directories(${PROJECT_BINARY_DIR}/src
${PROJECT_SOURCE_DIR}/../lib
${CMAKE_CURRENT_BINARY_DIR})


add_executable(SAMPLEAPP ${SAMPLE_SOURCES} 
    ${SAMPLE_HEADERS_MOC} 
    ${SAMPLE_FORMS_HEADERS} 
    ${SAMPLE_HEADERS_UI_H}
)
target_link_libraries(SAMPLEAPP ${QT_LIBRARIES})
#******************************************************************


Snippet out of my actual build.make file that is generated from cmake

src/SampleControl.h: ../src/SAMPLEAPP/ui/SampleControl.ui
$(CMAKE_COMMAND) -E cmake_progress_report SAMPLEAPP/build/CMakeFiles $(CMAKE_PROGRESS_22)
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold "Generating SampleControl.h"
SAMPLEAPP/build/src && /usr/bin/uic-qt3 -o SAMPLEAPP/build/src/SampleControl.h SAMPLEAPP/src/SAMPLEAPP/ui/SampleControl.ui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111011/0abcdb08/attachment-0001.htm>


More information about the CMake mailing list