Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator: Shared project settings for CMake project
QtWS25 Last Chance

Qt Creator: Shared project settings for CMake project

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
12 Posts 5 Posters 3.0k 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.
  • Christian EhrlicherC Online
    Christian EhrlicherC Online
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #2

    What settings to do you want to share exactly?

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    T 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      What settings to do you want to share exactly?

      T Offline
      T Offline
      toralf
      wrote on last edited by toralf
      #3

      I want to share the actual build and run configurations from the Qt Creator project settings. For a certain project I'm importing, the build configs that are generated when you load a CMake configuration are not 100 % suitable; I need to

      • Assign a special kit, which sets up an "alternative" compiler and CMake version. (I want to be able to share that, too, but that's in a way a separate issue.)
      • Change the build directory - as the CMake set-up tries to enforce certain conventions. (I could change the Build&Run default, but that's not really a shared setting, either.)
      • Make some minor adjustments to the CMake settings
      • Define a number of environment variables

      In addition to that, I want to add extra configs for special cases like a partial build. (This is a fairly large multi-directory project.)

      For the run configs, I may need a "non-default" current directory as well as special command line arguments in some cases.

      I might perhaps also mention that ideally, I want to set up the environment variables in a project-wide manner (but not system-wide or user-wide) rather than defining them in every build configuration, but I can't find a way to do that.

      1 Reply Last reply
      0
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #4

        But such settings are neither stored in cmake nor qmake files. I think you have to dig into the qtcreator configuration files to see if you can share some of them

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        T 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          But such settings are neither stored in cmake nor qmake files. I think you have to dig into the qtcreator configuration files to see if you can share some of them

          T Offline
          T Offline
          toralf
          wrote on last edited by toralf
          #5

          @Christian-Ehrlicher
          It seems like you didn't read my original post.

          For a CMake project, these settings are stored in a file called CMakeLists.txt.user. That file is not cmake config as such - it's qtcreator specific. The problem is, it also contains dynamic state information that changes pretty much every time you run qtcreator. That means it's not quite an ideal candidate for sharing.

          For qmake projects, there is a similar situation; config and state is stored in a file with extension .pro.user - but in that case, you can also choose to put "static" information in a .pro.shared file, and the .pro.user file gets synced against it on start-up. That's documented in the link I provided. I was asking if there is an equivalent mechanism for CMake.

          1 Reply Last reply
          0
          • Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by Christian Ehrlicher
            #6

            The CMakeLists.txt.user is not meant to be moved around. Neither is .pro.user
            There is nothing like a .txt.shared file nor does my qtcreator (4.8.2) create such a file when I open a .pro project file so I don't know what's inside this file which could be shared somehow.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            1
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #7

              Hi,

              @Christian-Ehrlicher the content of the .pro.shared file is explained here.

              I don't know however if there's an equivalent for cmake currently.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @SGaist said in Qt Creator: Shared project settings for CMake project:

                I don't know however if there's an equivalent for cmake currently.

                No since these are no configuration specific parameters but settings for the editor. Looks like qtcreator is misusing a the .pro extension since it has even nothing to do with the qmake syntax. But maybe @aha_1980 knows more?

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                aha_1980A T 2 Replies Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  @SGaist said in Qt Creator: Shared project settings for CMake project:

                  I don't know however if there's an equivalent for cmake currently.

                  No since these are no configuration specific parameters but settings for the editor. Looks like qtcreator is misusing a the .pro extension since it has even nothing to do with the qmake syntax. But maybe @aha_1980 knows more?

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  Hi @Christian-Ehrlicher @SGaist @toralf

                  I honestly don't know how the state of CMake .shared is. Best would be to ask on the [Creator mailing list]https://lists.qt-project.org/listinfo/qt-creator() where the developers can better answer that question.

                  However, as @Christian-Ehrlicher already said, the .shared settings are not thought for build system specific setups. There is an idea that a project setup wizard could do things like that, but I'm not even aware of a task, not to mention a date when that could happen.

                  The only thing I can say, is that many people have similar needs as you have and such a wizard would be very welcome.

                  Regards

                  Qt has to stay free or it will die.

                  T 1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    @SGaist said in Qt Creator: Shared project settings for CMake project:

                    I don't know however if there's an equivalent for cmake currently.

                    No since these are no configuration specific parameters but settings for the editor. Looks like qtcreator is misusing a the .pro extension since it has even nothing to do with the qmake syntax. But maybe @aha_1980 knows more?

                    T Offline
                    T Offline
                    toralf
                    wrote on last edited by
                    #10

                    @Christian-Ehrlicher said in Qt Creator: Shared project settings for CMake project:

                    @SGaist said in Qt Creator: Shared project settings for CMake project:

                    I don't know however if there's an equivalent for cmake currently.

                    No since these are no configuration specific parameters but settings for the editor

                    On what do you base that statement?

                    As far as I can tell, project.pro.user or CMakeLists.txt.user or (for a plain Makefile project) project.creator.user contains everything you enter in the Projects mode GUI, including build and run settings, and that information is stored nowhere else, and qtcreator looks for all ".user" settings in ".shared" as well in cases where the file is supported.

                    The .pro.shared documentation does mention

                    Typically, you would share some of the values in the ProjectExplorer.Project.EditorSettings section.

                    but that's a far cry from saying that the file is meant exclusively for editor settings.

                    1 Reply Last reply
                    0
                    • aha_1980A aha_1980

                      Hi @Christian-Ehrlicher @SGaist @toralf

                      I honestly don't know how the state of CMake .shared is. Best would be to ask on the [Creator mailing list]https://lists.qt-project.org/listinfo/qt-creator() where the developers can better answer that question.

                      However, as @Christian-Ehrlicher already said, the .shared settings are not thought for build system specific setups. There is an idea that a project setup wizard could do things like that, but I'm not even aware of a task, not to mention a date when that could happen.

                      The only thing I can say, is that many people have similar needs as you have and such a wizard would be very welcome.

                      Regards

                      T Offline
                      T Offline
                      toralf
                      wrote on last edited by toralf
                      #11

                      The only thing I can say, is that many people have similar needs as you have and such a wizard would be very welcome.

                      I honestly don't see what good something like that would do. The principal mechanism for sharing configuration is already in place, and like I said elsewhere, it does support build and run configurations. I've no idea whether it was "meant for" that purpose, but it works, so why should I care? The only problem is that support for the CMake version of the XML files may be missing.

                      Or, I guess there is some room for improvement - like there might be a simpler way to copy settings to the shared configuration than using a plaintext editor, and there could be a better mechanism for setting up "project relative" file names and paths. A "project setup wizard" doesn't sound like something that would address those issues, though.

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        pehg
                        wrote on last edited by
                        #12

                        @toralf did you find a way to share settings in a CMake project? I'm trying to do the same but no luck so far.

                        1 Reply Last reply
                        0

                        • Login

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