Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123649

automatically load settings from CMakeLists.txt

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 6.8
    • Core: Other
    • None
    • All

    Description

      I love Qt and Qt loves CMake.

      Inside my CMakeLists.txt I wrote

      project(myAppName LANGUAGES CXX DESCRIPTION "My good app" VERSION 1.2.3.4)
      

      I expect that setApplicationName will done automatically based on CMakeLists.txt The same for setApplicationVersion.

      But for now I need dirty hack. Inside CMakeLists.txt

      add_compile_definitions( -DMYPROJECT_NAME=${PROJECT_NAME} )
      

      Inside main.cpp

      #define Q(x) #x
      #define QUOTE(x) Q(x)
      QCoreApplication::setApplicationName(QUOTE(MYPROJECT_NAME));
      

      With dirty hack I can use ${PROJECT_NAME} from CMakeLists.txt for setApplicationName. I suggest Qt automatically load settings from CMakeLists.txt. There is another method to export variables.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            dungeonlords Andrei Cherniaev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes