(cmake 3.11.1) CMAKE_AUTORCC fails with Xcode generator
Steps to reproduce:
- Install CMake 3.11.1,
- Make sure Qt 5 can be found by CMake,
- Download the files attached,
- Generate XCode project:
cmake -GXcode <path-to-src>
, - Build Release configuration:
cmake --build . --config Release
, - Build Debug configuration:
cmake --build . --config Debug
.
The latter build will fail with the following message:
qrc_my_resources.cpp:3:10: fatal error: 'EWIEGA46WW/qrc_my_resources_CMAKE_.cpp' file not found
#include <EWIEGA46WW/qrc_my_resources_CMAKE_.cpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
If the order of configurations built changes, only the first will succeed.
The build fails because my_app_autogen/include_<config>/<HASH>/qrc_my_resources_CMAKE_.cpp
file (used by my_app_autogen/EWIEGA46WW/qrc_my_resources.cpp
) is generated only for the first configuration built.
As I understand, the problem is in CMakeScripts/my_app_cmakeRulesBuildPhase.make<config>
files:
# Generated by CMake, DO NOT EDIT
# Custom rules for my_app
.SUFFIXES:
all: \
/<path-to-build>/my_app_autogen/EWIEGA46WW/qrc_my_resources.cpp
/<path-to-build>/my_app_autogen/EWIEGA46WW/qrc_my_resources.cpp: \
/<path-to-src>/my_resources.qrc\
/<path-to-build>/CMakeFiles/my_app_autogen.dir/RCCmy_resourcesInfo.cmake\
/<path-to-src>/my_data.data
echo "Automatic RCC for my_resources.qrc"
cd /<path-to-build> && /<path-to-cmake>/cmake -E cmake_autorcc /<path-to-build>/CMakeFiles/my_app_autogen.dir/RCCmy_resourcesInfo.cmake Debug
In particular this line seems to be problematic:
all: \
/<path-to-build>/my_app_autogen/EWIEGA46WW/qrc_my_resources.cpp
It declares dependency on arc_my_resources.cpp
, which is generated when the first configuration builds. So all other configurations will do nothing on this step and thus no configuration-specific RCC file will be generated.
Everything seemed to work when I manually tried to change that line (and the next one) to this:
all: \
/<path-to-build>/my_app_autogen/include_Debug/EWIEGA46WW/qrc_my_resources_CMAKE_.cpp
/<path-to-build>/my_app_autogen/include_Debug/EWIEGA46WW/qrc_my_resources_CMAKE_.cpp: \
...