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

Robert Maynard robert.maynard at kitware.com
Mon Aug 7 13:56:42 EDT 2017


Did this work pre CMake 3.9?

On Mon, Aug 7, 2017 at 8:49 AM, Steffen Dettmer
<steffen.dettmer at gmail.com> wrote:
> 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
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list