[CMake] qt .qrc file modifications require two builds

Clinton Stimpson clinton at elemtech.com
Wed Dec 16 16:25:20 EST 2009


It looks like a bug in the Xcode generator.
Here's an even simpler example:

project(test_xcode)

add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/test.h
     COMMAND cp ${CMAKE_SOURCE_DIR}/test.h.in ${CMAKE_BINARY_DIR}/test.h
     DEPENDS ${CMAKE_SOURCE_DIR}/test.h.in
     )

include_directories(${CMAKE_BINARY_DIR})

add_executable(test_xcode
     ${CMAKE_BINARY_DIR}/test.h
     ${CMAKE_SOURCE_DIR}/test.h.in
     main.cpp)

I have to hit build twice if test.h.in is modified.

Clint


On Dec 16, 2009, at 2:00 PM, Glenn Hughes wrote:

> 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
> _______________________________________________
> 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