[CMake] Double builds required in XCode w/CMake when changing UI code in QtDesigner

Michael Jackson mike.jackson at bluequartz.net
Wed Apr 29 16:17:48 EDT 2009


You might try the following:


add_executable ( Sumatra  ${SumatrSources} ${SumatraUISHeaders} )

and see what happens.


Here is a snippet from one of my own projects:


# -- Run MOC and UIC on the necessary files
QT4_ADD_RESOURCES( Generated_RC_SRCS ${ModelEditor_RCS} )

# this will run uic on .ui files:
QT4_WRAP_UI( Generated_UI_HDRS ${ModelEditor_UIS} )

# and finally this will run moc:
QT4_WRAP_CPP( Generated_MOC_SRCS ${ModelEditor_MOC_HDRS} )

#-- Put the generated files into their own group for IDEs
MXA_GENERATED_PROPERTIES(ModelEditor/Generated
                             "${Generated_UI_HDRS}"
                             "${Generated_MOC_SRCS}")

# -- Finally set the Project Sources to include all the sources
SET (${PROJECT_NAME}_PROJECT_SRCS
     ${ModelEditor_SRCS}
     ${ModelEditor_MOC_HDRS}
     ${Generated_RC_SRCS}
     ${Generated_UI_HDRS}
     ${Generated_MOC_SRCS}
)
ADD_EXECUTABLE( ${ModelEditor_EXE_NAME} ${GUI_TYPE} ${$ 
{PROJECT_NAME}_PROJECT_SRCS} )

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Apr 29, 2009, at 3:56 PM, Daniel Blezek wrote:

> Sorry if this has been discussed before, but I couldn’t find  
> anything in Google.
>
> When building with XCode and Qt, I have to build twice when I change  
> my .ui files in QtDesigner.  Apparently the build order is wrong?   
> The first build re-generates the ui_*.h files, but doesn’t trigger  
> the dependencies.  The second build does the right thing.
>
> Something I can live with (my fingers are now trained to hit Command- 
> B twice), but perhaps there is an easy fix?
>
> In my CMakeLists.txt file, this is the order of Qt-related operations:
>
> set ( SumatraSource
>   ...
> )
>
> set ( SumatraHeaders
> ... )
> qt4_wrap_cpp ( SumatraMOCSource ${SumatraHeaders} )
>
> set ( SumatraUIS
> ... )
>
> qt4_wrap_ui ( SumatraUISHeaders ${SumatraUIS} )
>
> qt4_add_resources ( SumatraResources Resources.qrc )
>
> add_executable ( Sumatra ... )
>
> Perhaps this is the wrong order?
>
> Thanks,
> -dan
>
> -- 
> Daniel Blezek, PhD
> Medical Imaging Informatics Innovation Center
>
> P 127 or (77) 8 8886
> T 507 538 8886
> E blezek.daniel at mayo.edu
>
> Mayo Clinic
> 200 First St. S.W.
> Harwick SL-44
> Rochester, MN 55905
> mayoclinic.org
>
> _______________________________________________
> 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