Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26008

Hint that CMakeCache.txt can be removed if a project won't build but there were no CMake errors

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • None

    Description

      I just got into a situation where there were no CMake errors (when e.g. configuring qtquickcontrols2) yet the project wouldn't build. Prior to that I had pasted some CMake into one of my CMakeLists.txt (qtquickcontrols2\tests\auto\controls\windows\CMakeLists.txt, after checking out https://codereview.qt-project.org/c/qt/qtquickcontrols2/+/356159) which contained invalid, special characters:

      # Collect test data
      file(GLOB_RECURSE test_data_glob
          RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
          ${CMAKE_CURRENT_SOURCE_DIR}/../data/tst_*)
      list(APPEND test_data ${test_data_glob})
      list(FILTER test_data EXCLUDE REGEX "(\
      .*tst_abstractbutton\\.qml|\
      .*tst_action\\.qml|\
      .*tst_actiongroup\\.qml|\
      .*tst_applicationwindow\\.qml|\
      .*tst_busyindicator\\.qml|\
      .*tst_buttongroup\\.qml|\
      .*tst_checkdelegate\\.qml|\
      .*tst_container\\.qml|\
      .*tst_control\\.qml|\
      .*tst_delaybutton\\.qml|\
      .*tst_dial\\.qml|\
      .*tst_dialog\\.qml|\
      .*tst_dialogbuttonbox\\.qml|\
      .*tst_drawer\\.qml|\
      .*tst_horizontalheaderview\\.qml|\
      .*tst_itemdelegate\\.qml|\
      .*tst_label\\.qml|\
      .*tst_menu\\.qml|\
      .*tst_menubar\\.qml|\
      .*tst_menubaritem\\.qml|\
      .*tst_menuitem\\.qml|\
      .*tst_menuseparator\\.qml|\
      .*tst_page\\.qml|\
      .*tst_pageindicator\\.qml|\
      .*tst_pane\\.qml|\
      .*tst_popup\\.qml|\
      .*tst_radiodelegate\\.qml|\
      .*tst_rangeslider\\.qml|\
      .*tst_roundbutton\\.qml|\
      .*tst_scrollindicator\\.qml|\
      .*tst_selectionrectangle\\.qml|\
      .*tst_splitview\\.qml|\
      .*tst_stackview\\.qml|\
      .*tst_swipedelegate\\.qml|\
      .*tst_swipeview\\.qml|\
      .*tst_switch\\.qml|\
      .*tst_switchdelegate\\.qml|\
      .*tst_tabbar\\.qml|\
      .*tst_tabbutton\\.qml|\
      .*tst_toolbar\\.qml|\
      .*tst_toolbutton\\.qml|\
      .*tst_toolseparator\\.qml|\
      .*tst_tooltip\\.qml|\
      .*tst_tumbler\\.qml|\
      .*tst_verticalheaderview\\.qml\
      )")
      set(test_data_dir "${CMAKE_CURRENT_BINARY_DIR}/data")
      # TODO: workaround for QTBUG-94961; remove when fixed.
      # It copies the test files to a separate directory (in the build dir)
      # and passes this directory to the test binary.
      file(MAKE_DIRECTORY "${test_data_dir}")
      foreach(qml_test_file IN LISTS test_data)
          file(CREATE_LINK "${​​​​​​​CMAKE_CURRENT_SOURCE_DIR}​​​​​​​/${​​​​​​​​qml_test_file}​​​​​​​​​​​​​​​" "${​​​​​​​​​​​​​​​test_data_dir}​​​​​​​​​​​​​​​/${​​​​​​​​​​​​​​​qml_test_file}​​​​​​​​​​​​​​​" COPY_ON_ERROR)
      endforeach()
      
      qt_internal_add_test(tst_windows
          GUI
          QMLTEST
          SOURCES
              tst_windows.cpp
          DEFINES
              TST_CONTROLS_DATA=\\\"${CMAKE_CURRENT_SOURCE_DIR}/../../../../tests/auto/controls/data\\\"
          PUBLIC_LIBRARIES
              Qt::Gui
              Qt::QuickControls2
          TESTDATA ${test_data}
      )
      

      Presumably this broke stuff:

      CMake Error at tests/auto/controls/windows/CMakeLists.txt:59 (file):
        Syntax error in cmake code at
      
       
      
          C:/dev/qt-dev/qtquickcontrols2/tests/auto/controls/windows/CMakeLists.txt:59
      
       
      
        when parsing string
      
       
      
          ${​​​​​​​CMAKE_CURRENT_SOURCE_DIR}​​​​​​​/${​​​​​​​​qml_test_file}​​​​​​​​​​​​​​​
      
       
      
        Invalid character ('�') in a variable name: ''
      
       
      
      
      CMake Error at tests/auto/controls/windows/CMakeLists.txt:59 (file):
        Syntax error in cmake code at
      
       
      
          C:/dev/qt-dev/qtquickcontrols2/tests/auto/controls/windows/CMakeLists.txt:59
      
       
      
        when parsing string
      
       
      
          ${​​​​​​​​​​​​​​​test_data_dir}​​​​​​​​​​​​​​​/${​​​​​​​​​​​​​​​qml_test_file}​​​​​​​​​​​​​​​
      
       
      
        Invalid character ('�') in a variable name: ''
      

      It would help if hovering over the build/run buttons in this situation (no build errors but unable to build) would show a tooltip suggesting that the user try removing their CMakeCache.txt from the build directory.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            cadam Cristian Adam
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes