[CMake] CMake + UIC files -- Is this a bug with CMake or with me?

John Drescher drescherjm at gmail.com
Tue Jul 20 16:26:52 EDT 2010


On Tue, Jul 20, 2010 at 4:09 PM, kent williams
<nkwmailinglists at gmail.com> wrote:
> Thanks.  I don't know if you've actually tried the project I put up to
> illustrate the project, but while what you say makes sense, it doesn't
> appear to fix the problem.
>
> It's frustrating for me; apparently, though I'm following exactly the
> pattern that's reputed to work, CMake isn't generating the Makefile
> code to deal with the second .ui file.
>
> Either there's something wrong in CMake, or I'm somehow missing
> something in what should be a really simple CMakeLists.txt.
>

I do not do globbing. I just add the result of QT4_WRAP_UI to my target


SET( ${PROJECT_NAME}_SRCS
	./src/main.cxx
	./src/mainwindow.cxx
	./src/textwidget.cxx
	./src/upmcLungApp.cxx
	./src/AppSettingsDlg.cxx
	./src/laFileMenu.cxx
  )

SET( ${PROJECT_NAME}_MOC_HDR
	./Include/mainwindow.h
	./Include/textwidget.h
	./Include/upmcLungApp.h
	./Include/AppSettingsDlg.h
	./Include/laFileMenu.h
)

SET( ${PROJECT_NAME}_HDRS
	./Include/ClickedPointEvent.h
	./Include/${PROJECT_NAME}Constants.h
	./Include/sliceOrientation.h
)

#########################################################################################

MSVC_PCH_SUPPORT(${PROJECT_NAME})

# some .ui files
SET( ${PROJECT_NAME}_UIS
	./rc/AppSettings.ui
)

# and finally an resource file
SET( ${PROJECT_NAME}_RCS
	./rc/${PROJECT_NAME}.qrc
)

# this command will generate rules that will run rcc on all files from
${PROJECT_NAME}_RCS
# in result ${PROJECT_NAME}_RC_SRCS variable will contain paths to
files produced by rcc
QT4_ADD_RESOURCES( ${PROJECT_NAME}_RC_SRCS ${${PROJECT_NAME}_RCS} )

# and finally this will run moc:
QT4_WRAP_CPP( ${PROJECT_NAME}_MOC_SRCS ${${PROJECT_NAME}_MOC_HDR} )

# this will run uic on .ui files:
QT4_WRAP_UI( ${PROJECT_NAME}_UI_HDRS ${${PROJECT_NAME}_UIS} )

SOURCE_GROUP("Generated" FILES
	  ${${PROJECT_NAME}_RC_SRCS}
	  ${${PROJECT_NAME}_MOC_SRCS}
	  ${${PROJECT_NAME}_UI_HDRS}
)

SOURCE_GROUP("Resources" FILES
	  ${${PROJECT_NAME}_UIS}
	  ${${PROJECT_NAME}_RCS}
)

#########################################################################################


ADD_EXECUTABLE( ${PROJECT_NAME} ${${PROJECT_NAME}_SRCS}
${${PROJECT_NAME}_MOC_SRCS} ${${PROJECT_NAME}_HDRS}
		${${PROJECT_NAME}_MOC_HDR} ${${PROJECT_NAME}_RC_SRCS}
${${PROJECT_NAME}_UI_HDRS}
)
	

Right now I am doing all of my development in Visual Studio. In the
past this project did build under linux.

John


More information about the CMake mailing list