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. Work with the same CMake Qt project with both Visual Studio and Qt Creator

Work with the same CMake Qt project with both Visual Studio and Qt Creator

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 3 Posters 851 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.
  • F Offline
    F Offline
    FalsinSoft
    wrote on 18 Jul 2024, 19:23 last edited by
    #1

    Hi all

    My request is a bit strange but cause my inexperience with CMake I didn't find a solution to my problem yet. Basically I use Visual Studio to develop 90% of the app and then use Qt Creator to compile the final package for Android or Linux. At the moment I use two separate project files, one in VS .sln format and CMake for Qt Creator. I would like to use a unique CMake project file for both but I have the following problem. Qt Creator basically need only the CMakeLists.txt since the IDE already have all the paths to the Qt libraries and so on. On the contrary use CMake with Visual Studio require the two additional files CMakePresets.json and CMakeUserPresets.json generated by the QT Tools VS plugin. My problem is if I try to open the project working with Visual Studio (containing CMakeLists.txt, CMakePresets.json and CMakeUserPresets.json) with Qt Creator it detect the two .json files and set the environment based to the info contained in it with the result the compilation doesn't work.
    Now my question is if there is a way to "exclude" the two additional json file in case of use of Qt Creator. Obviously a different working solutoon will be welcomed too.
    Thank you

    1 Reply Last reply
    0
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 18 Jul 2024, 19:44 last edited by
      #2

      Simply use the CMake Visual Studio Generator instead Ninja or whatever is configured in QtCreator.

      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
      0
      • F Offline
        F Offline
        FalsinSoft
        wrote on 19 Jul 2024, 19:31 last edited by
        #3

        I'm sorry but I don't understand very well your suggestion. Can you clarify better? Please note I develop my CMake project using Visual Studio under Windows but it could happen also I need to compile this same project using Qt Creator in a Linux machine, than I need the same CMake project filr work in both IDE...

        1 Reply Last reply
        0
        • C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 19 Jul 2024, 19:42 last edited by
          #4

          I don't see what this has to do with Linux - you are using cmake which is cross platform. Cmake can create a visual studio solution which you use with MSVC. This can also used by QtCreator - simply specify the appropriate build tool in the QtCreator kit settings.

          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
          0
          • F Offline
            F Offline
            FalsinSoft
            wrote on 20 Jul 2024, 10:22 last edited by
            #5

            Il'' try to make a pratical example. I want to develop and Android app based to Qt. Since I prefer to use Visual Studio as main IDE I create a new project using the QT VS Tools plugin based to CMake. The wizard create a project with the files CMakeLists.txt, CMakePresets.json and CMakeUserPresets.json. Using this project files I develop the app under Windows using VS. Once is ready to start testing undert Android I use Qt Creator with Android SDK configured to compile the same app for Android. However if I open a projet with only CMakeLists.txt present Qt Creator correctly ask me which kits of those available I want to use for the compilation and in my case I select Android arm64_v8a. However if the files CMakePresets.json and CMakeUserPresets.json are present in the same folder Qt Creator want to directly use the paths configured insithe them and doesn't ask me nothing about other kits. So in this case I can not compile any Android app.
            Basically this is my problem...

            1 Reply Last reply
            0
            • C Online
              C Online
              cristian-adam
              wrote on 21 Jul 2024, 11:21 last edited by
              #6

              The other Kits are still there. They are not presented in the right pane, but you can always click on the left an activate a Kit you want to have.

              qtcreator-presets.png

              1 Reply Last reply
              0
              • F Offline
                F Offline
                FalsinSoft
                wrote on 23 Jul 2024, 18:10 last edited by
                #7

                Correct, this solve my problem. Thank you and I'm sorry I didn't note this option before but I use Qt Creator only to compile for system different from Windows and I don't know very well the interface...

                1 Reply Last reply
                0
                • F FalsinSoft has marked this topic as solved on 23 Jul 2024, 18:11

                4/7

                19 Jul 2024, 19:42

                • Login

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