[CMake] qt .qrc file modifications require two builds
Glenn Hughes
ghughes02138 at gmail.com
Wed Dec 16 16:00:57 EST 2009
Here's a very short example that demonstrates the problem.
This is a CMake file for the "states" qt 4.6 example
(Developer/Examples/Qt/animation/states)
#---
PROJECT(states) # the name of your project
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project
INCLUDE(${QT_USE_FILE})
SET ( states_SRCS main.cpp )
SET ( states_HEADERS main.h )
SET ( states_RESOURCES states.qrc )
QT4_WRAP_CPP( states_MOC_files ${states_HEADERS})
QT4_ADD_RESOURCES( states_RESOURCES_SOURCES ${states_RESOURCES} )
INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} )
ADD_EXECUTABLE( states MACOSX_BUNDLE ${states_SRCS}
${states_MOC_files} ${states_RESOURCES_SOURCES} )
TARGET_LINK_LIBRARIES(states ${QT_LIBRARIES})
#---
Put this in the states directory, run CMake ./ -G Xcode
Open the Xcode project and build. Builds fine.
Next, open states.qrc, make any sort of modification, even just typing
a space. Save the file.
Build. You will notice the "run custom script" phase executes, but
that's all. (qrc_states.cxx is generated)
Press Build again. You will notice that qrc_states.cxx compiles and
the project is relinked. That should have been done the first time.
G
More information about the CMake
mailing list