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. cmake tests and libs separate view in qt creator
Forum Updated to NodeBB v4.3 + New Features

cmake tests and libs separate view in qt creator

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
21 Posts 4 Posters 3.2k Views 1 Watching
  • 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.
  • cristian-adamC Offline
    cristian-adamC Offline
    cristian-adam
    wrote on last edited by
    #12

    CMake already has the SOURCES property, you just need to use cmake generator expressions to use it.

    Take this example:

    cmake_minimum_required(VERSION 3.16)
    
    project(WidgetsApp VERSION 0.1 LANGUAGES CXX)
    
    add_subdirectory(app)
    add_subdirectory(tests)
    
    add_custom_target(MyApp
        SOURCES $<LIST:TRANSFORM,$<LIST:FILTER,$<TARGET_PROPERTY:WidgetsApp,SOURCES>,EXCLUDE,.*_autogen/.*>,PREPEND,app/>
    )
    

    global_custom_targets.png

    Christian EhrlicherC 1 Reply Last reply
    3
    • cristian-adamC cristian-adam

      CMake already has the SOURCES property, you just need to use cmake generator expressions to use it.

      Take this example:

      cmake_minimum_required(VERSION 3.16)
      
      project(WidgetsApp VERSION 0.1 LANGUAGES CXX)
      
      add_subdirectory(app)
      add_subdirectory(tests)
      
      add_custom_target(MyApp
          SOURCES $<LIST:TRANSFORM,$<LIST:FILTER,$<TARGET_PROPERTY:WidgetsApp,SOURCES>,EXCLUDE,.*_autogen/.*>,PREPEND,app/>
      )
      

      global_custom_targets.png

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #13

      @cristian-adam this looks more like a hack to me... 🙂

      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
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by Christian Ehrlicher
        #14

        I just saw that I mixed SOURCES And FOLDERS properties - I meant FOLDERS, sorry for the confusion.
        https://cmake.org/cmake/help/latest/prop_tgt/FOLDER.html

        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
        • S Offline
          S Offline
          Sandon
          wrote on last edited by Sandon
          #15

          @Christian-Ehrlicher thank you very much! This is quite new to me, so it will take time to understand and rewrite it in a way that works for what I need.. but it could be the "hack/trick" I was looking for.

          Edit: after reading it carefully, I am still not sure if this applies to my case. Going to read the documentation. Basically I will need a way to read specific CMakeFiles and associate them to a specific target.

          1 Reply Last reply
          0
          • cristian-adamC Offline
            cristian-adamC Offline
            cristian-adam
            wrote on last edited by
            #16

            Regarding FOLDER, yes, I'll have to fix https://bugreports.qt.io/browse/QTCREATORBUG-28873 first.

            Currently Qt Creator is abusing FOLDER to make a target runnable. See https://doc.qt.io/qtcreator/creator-run-settings.html#cmake-run-targets

            Well, actually, I could keep the qtc_runnable special handling, and have original intent. One wouldn't be able to have both.

            1 Reply Last reply
            1
            • S Offline
              S Offline
              Sandon
              wrote on last edited by
              #17

              @cristian-adam thank you for your reply.

              Do you think is it possible to achieve what I asked with current Qt creator capabilities?

              cristian-adamC 1 Reply Last reply
              0
              • S Sandon

                @cristian-adam thank you for your reply.

                Do you think is it possible to achieve what I asked with current Qt creator capabilities?

                cristian-adamC Offline
                cristian-adamC Offline
                cristian-adam
                wrote on last edited by
                #18

                @Sandon said in cmake tests and libs separate view in qt creator:

                @cristian-adam thank you for your reply.

                Do you think is it possible to achieve what I asked with current Qt creator capabilities?

                Nope. I have a fix for https://bugreports.qt.io/browse/QTCREATORBUG-28873, you can take an artifact from https://github.com/cristianadam/qt-creator/actions/runs/9979288965 and try it out.

                After the code review is done, you can have a Qt Creator 15 snapshot from https://download.qt.io/development_releases/qtcreator/ when they are available.

                1 Reply Last reply
                0
                • cristian-adamC Offline
                  cristian-adamC Offline
                  cristian-adam
                  wrote on last edited by
                  #19

                  Alternatively you can fork Qt Creator on github, apply the patch from https://codereview.qt-project.org/c/qt-creator/qt-creator/+/576805 and push a release tag on github.

                  This will get you a Qt Creator 14 release with the patch in.

                  1 Reply Last reply
                  0
                  • cristian-adamC Offline
                    cristian-adamC Offline
                    cristian-adam
                    wrote on last edited by
                    #20

                    Qt Creator is open source, Qt Creator is written in C++, and you don't have to do much in order to get a build on GitHub.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Sandon
                      wrote on last edited by
                      #21

                      @cristian-adam that's awesome mate, great job. I look forward to try it out. Thanks again!

                      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