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

CMake Cache Variables should be shown, even if Configuration failed

    XMLWordPrintable

Details

    • All
    • fdccc542754bc5361b8391ecd3902a88a84ab3cf

    Description

      Hi,

      Qt creator should populate the GUI-field with cache variables, even if configuration fails.
      To understand:

      Please run the following mini CMakeLists.txt in Qt Creator

       

      cmake_minimum_required(VERSION 3.4)
      project(go)
      
      set(MONTH_INITIAL "Please specify a month")
      set(MONTH ${MONTH_INITIAL}  CACHE STRING "Please specify month")
      
      set(MONTH_CHOICES "January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December")
      
      set_property(CACHE MONTH
        PROPERTY STRINGS ${MONTH_CHOICES})
      
      if (NOT MONTH IN_LIST MONTH_CHOICES)
        message(FATAL_ERROR "Specify MONTH. Must be one of ${MONTH_CHOICES}")
      endif()
      
      message("######## Month is set to ${MONTH}")
      

       

      It will (correctly) fail with message:

       

      CMake Error at CMakeLists.txt:14 (message):
      
      Specify MONTH. Must be one of
      January;February;March;April;May;June;July;August;September;October;November;December
      

       

      But under Project Settings, we see that the field with CMake Cache Variables is empty

       

      This  should be improved!!

      I would like to see the cache variable MONTH with value set to "Please specify a month" (which is the default via MONTH_INITIAL) and then if I click, I want to get a drop-down with the possible choices: "January", "February", etc.

       

       

      The command

      grep -r MONTH . 

      shows the following

      ./CMakeCache.txt:MONTH:STRING=Please specify a month
      ./CMakeCache.txt://STRINGS property for variable: MONTH
      ./CMakeCache.txt:MONTH-STRINGS:INTERNAL=January;February;March;April;May;June;July;August;September;October;November;December

      So all the information is there, even if Configuration failed. It should be displayed in the field.

       

      PS: cmake-gui has exactly this desired behaviour:

      cmake-gui /path/to/top
      # then click bottom-left Configure button and choose any Generator and click Finish

      Attachments

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

        Activity

          People

            hunger Tobias Hunger
            nicesw123 nicesw123
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes