[CMake] with cmake-3.9 my testprj breaks, I need to add "add_executable(Qt4::rcc IMPORTED)"

Steffen Dettmer steffen.dettmer at gmail.com
Mon Aug 7 08:49:50 EDT 2017


Hi,

I have a cmake test project that builds a "hello world" with our
cross toolchain. There are selfmade TOOLCHAINFILES for the
targets. They define QT variables like:

  set(BT_QT_4_7_3_PATH        .../taget/Qt-4.7.3)
  set(QT_BINARY_DIR            ${BT_QT_4_7_3_PATH}/bin)
  set(QT_LIBRARY_DIR           ${BT_QT_4_7_3_PATH}/lib)
  set(QT_MOC_EXECUTABLE        ${QT_BINARY_DIR}/moc)

and so on. I tested a fix for [1] with master branch and then
also v3.9.0, but my project suddenly gets errors:

  $ git clone $r/helloworld && cd helloworld &&
    mkdir target4 && cd target4 &&
    /local/users/sdettmer/work/cmake/b/bin/cmake \
     -DCMAKE_TOOLCHAIN_FILE=$TC/$TARGET.cmake  ..
  -- The C compiler identification is GNU 4.4.3
  [...normal output...]
  -- Configuring done
  CMake Error: Qt4::rcc target not found hello_world
  CMake Error: Qt4::rcc target not found mylib1
  CMake Error: Qt4::rcc target not found mylib2
  -- Generating done
  -- Build files have been written to: /local/sdettmer/work/helloworld/target4

The "CMake Error:" lines are new. Please note, that I don't use QT rcc at all.

I noticed that I can work around this by adding:

  set(QT_RCC_EXECUTABLE ${QT_BINARY_DIR}/rcc)
  if (NOT TARGET Qt4::rcc)
    add_executable(Qt4::rcc IMPORTED)
  endif()

to my TOOLCHAINFILE, but I don't understand why. moc, for
example, needs no such thing, but rcc does, but this one is not
even used.

The message seems to come from C++ part, could it be that some QT
depenency slipped into the cmake (C++) code by accident?

Also after the error it tells "Generating done". Does this mean
the error actually is a warning I could ignore?

Steffen





[1] https://gitlab.kitware.com/cmake/cmake/issues/16920


More information about the CMake mailing list