No rule to make target 'RCS/../', needed by '../'. Stop.

No rule to make target 'RCS/../', needed by '../'. Stop.

par Tanish Patil,
Number of replies: 2

Me and my partner are working with CLion so that we can collaborate by pushing and pulling our code via GitHub. We reached a stage where his code compiled perfectly, but mine did not (he is on Mac and I am on Windows) I have attached an image of the general hierarchy of the project: project hierarchy

A folder called MathCore contains all the mathematical headers and .cc files, with subfolders for  "Integrateurs" and "Tests". The journal and main are contained in the main folder. 

After pulling his code, my initial error was as follows:
initial error
However, we managed to fix this by adding a line to CMakeLists.txt (the one found in the main folder), as follows:

set (CMAKE_PREFIX_PATH "C:\\Qt\\5.14.1\\msvc2017_64\\")

which is the path that the program was looking for. 
After doing this, we managed to load the CMakeLists.txt file. However, when building, we got a new error:

mingw32-make.exe[3]: No rule to make target 'RCS/../', needed by '../'. Stop.
mingw32-make.exe[2]:
[CMakeFiles/ToupieMain.dir/all] Error 2
mingw32-make.exe[1]: [CMakeFiles/ToupieMain.dir/rule] Error 2
mingw32-make.exe:
[ToupieMain] Error 2

As far as we can tell, the main issue is "No rule to make target ... needed by". We googled the issue and the specific issue with the target being RCS is fairly rare. I searched my computer for files named RCS and the closest match was in C:\\Qt, but it was buried deep inside a very specific folder that is almost certainly not being used by the program. According to google, the more general issue "No rule to make target" usually occers when the file (here, RCS) is not found, but we have no idea where this file could be (although since RCS is revision control system, this may be an issue with CLion trying to merge our projects together, although when we searched our problem on Google with the additional key word "CLion" we got no results.

Here is a photo of the CMakeLists.txt in full:
photo of cmakelists.txt

We tried a couple of simple fixes, like changing 

set(CMAKE_CXX_FLAGS "-O -mavx2 -funroll-loops")
to a comment, as it is only used for a very specific purpose on my partner's computer and I do not need it, and changing

set(CMAKE_CXX_STANDARD 17) to set(CMAKE_CXX_STANDARD 14)
in case I was on C++ 14 instead of 17, but neither fix worked.

Right now, I am re-installing Qt; in the worst case I will completely delete the project and pull it from GitHub again (because maybe an error was created when merging my project with the current version on GitHub, especially since my partner has done a lot more pushes than me!). But is there a simpler fix? 
In reply to Tanish Patil

Re: No rule to make target 'RCS/../', needed by '../'. Stop.

par Deleted user,

At the risk of making a large post, could you give us the full output of running

cmake

As well as

make VERBOSE=1
?

If it is too large, do not hesitate to put them in a text file and post these here.

In reply to Deleted user

Re: No rule to make target 'RCS/../', needed by '../'. Stop.

par Deleted user,

Quick update to this post, since we ended up figuring the issue out directly via email. Note we're talking about CMake, which is not the same program as QMake.

It appears the issue was caused by an erroneous call to include_directories using relative paths. However - and that may interest other CMake users on Windows - even after compiling successfully, the executable complained it could not find Qt DLLs (Qt5Core.dll, Qt5Widgets.dll, Qt5Gui.dll) or could not find a specific "entry point".

In addition to the steps described in the official Qt documentation, we needed to

  1. Make sure the same version of MinGW as the one provided by Qt was used. It could be found under the following path: C:\Qt\Tools\mingw730_32 (bin folder for g++).
  2. Call the windeployqt utility shipped with Qt (found under C:\Qt\5.14.1\bin). It will scan your executable and copy required Qt dependencies to the same folder (such as the DLL files mentioned above). Make sure that when calling this program, g++ as provided by Qt is in the path.
Those manipulations seem to be necessary only on Windows systems (MacOS reportedly worked out of the box). A modular CMakeLists.txt can conveniently be achieved by wrapping Windows specific code with:

if(WIN32)
#Windows only code here
endif()

Lastly, it is useful to have windeployqt called after each build, which can be achieved with the following CMake lines. Each word in italic needs to be adapted to your setup.

add_custom_command(TARGET yourMainTargetName POST_BUILD
COMMAND ${CMAKE_COMMAND} -E env PATH="pathToQtBinFolder;pathToQtMinGW"
pathToWindeployqt $<TARGET_FILE:yourMainTargetName>
COMMENT "Running windeployqt")