Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. cmake C++ 17 by default

cmake C++ 17 by default

Scheduled Pinned Locked Moved Solved German
6 Posts 4 Posters 960 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HDMIKabel
    wrote on 23 Oct 2020, 09:48 last edited by
    #1

    Hallo,

    ich nutze den Qt Creator 4.13.1 unter Manjaro und habe eine einfache Frage, die ich nach langer Recherche leider nicht selbst beantworten kann.
    Ich möchte, dass Qt Creator mit cmake standartmäßig C++ 17 verwendet, sodass ich nicht bei jedem neuen Projekt die Projektdatei oder die cmakelists.txt manuell ändern muss.

    Versucht habe ich es über die Kit Konfiguration (cmake configuration) mit:

    CMAKE_CXX_STANDARD 17:INTERNAL={#:20}
    

    leider hat das keinen Einfluss auf die cmakelists.txt.

    Wie kann ich das umsetzen, kann mir da vielleicht jemand weiterhelfen?

    Danke schonmal und Gruß
    HDMIKabel ^^

    J 1 Reply Last reply 23 Oct 2020, 09:53
    0
    • H HDMIKabel
      23 Oct 2020, 09:48

      Hallo,

      ich nutze den Qt Creator 4.13.1 unter Manjaro und habe eine einfache Frage, die ich nach langer Recherche leider nicht selbst beantworten kann.
      Ich möchte, dass Qt Creator mit cmake standartmäßig C++ 17 verwendet, sodass ich nicht bei jedem neuen Projekt die Projektdatei oder die cmakelists.txt manuell ändern muss.

      Versucht habe ich es über die Kit Konfiguration (cmake configuration) mit:

      CMAKE_CXX_STANDARD 17:INTERNAL={#:20}
      

      leider hat das keinen Einfluss auf die cmakelists.txt.

      Wie kann ich das umsetzen, kann mir da vielleicht jemand weiterhelfen?

      Danke schonmal und Gruß
      HDMIKabel ^^

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 23 Oct 2020, 09:53 last edited by
      #2

      @HDMIKabel If you want to use a specific C++ standard you should really define that in CMakeLists.txt, else - what will happen if somebody else tries to build the project on his/her machine? For me this is clearly a project setting belonging into CMakeLists.txt.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply 23 Oct 2020, 09:57
      1
      • J jsulm
        23 Oct 2020, 09:53

        @HDMIKabel If you want to use a specific C++ standard you should really define that in CMakeLists.txt, else - what will happen if somebody else tries to build the project on his/her machine? For me this is clearly a project setting belonging into CMakeLists.txt.

        J Online
        J Online
        J.Hilk
        Moderators
        wrote on 23 Oct 2020, 09:57 last edited by
        #3

        @jsulm ich glaube was @HDMIKabel meint ist wie er das Macro/DefaultSetup erweitern kann, damit automatisch generierte default CMakeList.txt um set (CMAKE_CXX_STANDARD 17) erweitert

        Ka ob das einfach möglich ist 🤷‍♂️


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          HDMIKabel
          wrote on 23 Oct 2020, 11:55 last edited by HDMIKabel
          #4

          @J-Hilk @jsulm
          Genau das meine ich :)

          Meinem Verständnis nach wird das ja von qt definiert.
          Im Moment steht in jeder generierten cmakelists.txt eines neu erstellten Projekts

          set(CMAKE_CXX_STANDARD 11)
          

          Das muss ja irgendwo herkommen.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sierdzio
            Moderators
            wrote on 23 Oct 2020, 12:05 last edited by
            #5

            Es kommt aus template Dataien in Qt Creator install dir:

            • QtCreator/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt
            • QtCreator/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt
            • QtCreator/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt
            • und so weiter

            (Z(:^

            1 Reply Last reply
            2
            • H Offline
              H Offline
              HDMIKabel
              wrote on 23 Oct 2020, 15:16 last edited by
              #6

              @sierdzio

              Danke, das war sehr hilfreich und genau das, was ich suchte.
              Problem gelöst :)

              1 Reply Last reply
              0

              1/6

              23 Oct 2020, 09:48

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved