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. QtCreator Qbs GoogleTest help needed
Qt 6.11 is out! See what's new in the release blog

QtCreator Qbs GoogleTest help needed

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
2 Posts 2 Posters 1.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.
  • X Offline
    X Offline
    Xavier Thomas
    wrote on last edited by
    #1

    Hi,

    I was looking to use GoogleTest in my Qbs project but could not figure out the best way to do it so I used QtCreator wizard to create a GoogleTest project and see the generated qbs product. This did not solve my problem because the build system needs to be passed a path to a source version of the GoogleTest framework while I want to support system install.

    However, looking at the generated code I thought I could do something similar but encountered an issue which I do not know if it ias a bug in Qbs or QtCreator or if the generated code I base mine on is just plain wrong.

    In the product qbs file I import some JS file with helper functions:

    import "googlecommon.js" as googleCommon
    Product{
        ...
        // here I can acces qbs properties (like hostOS)
       cpp.includePaths: {
                if (qbs.hostOS.contains("linux"))
                    ....
        }
    }
    

    but in the JS file the code is not fucntional

    function somefunc() {
            // here all qbs properties(like hostOS) are undefined
            // and code looking like this do not work
            if (qbs.hostOS.contains("linux"))
                return ;
    }
    

    I am not sure how to accomplish what I want to do, which is writing helper functions in my JS file that access the qbs module properties (like hostOS) ; or if I should fill a bug report for Qbs or QtCreator (In the code generated by Qtcreator the error does not pop-up because the erroneous code is never called). Any help is appreciated.

    Thanks

    jiancaiyangJ 1 Reply Last reply
    0
    • X Xavier Thomas

      Hi,

      I was looking to use GoogleTest in my Qbs project but could not figure out the best way to do it so I used QtCreator wizard to create a GoogleTest project and see the generated qbs product. This did not solve my problem because the build system needs to be passed a path to a source version of the GoogleTest framework while I want to support system install.

      However, looking at the generated code I thought I could do something similar but encountered an issue which I do not know if it ias a bug in Qbs or QtCreator or if the generated code I base mine on is just plain wrong.

      In the product qbs file I import some JS file with helper functions:

      import "googlecommon.js" as googleCommon
      Product{
          ...
          // here I can acces qbs properties (like hostOS)
         cpp.includePaths: {
                  if (qbs.hostOS.contains("linux"))
                      ....
          }
      }
      

      but in the JS file the code is not fucntional

      function somefunc() {
              // here all qbs properties(like hostOS) are undefined
              // and code looking like this do not work
              if (qbs.hostOS.contains("linux"))
                  return ;
      }
      

      I am not sure how to accomplish what I want to do, which is writing helper functions in my JS file that access the qbs module properties (like hostOS) ; or if I should fill a bug report for Qbs or QtCreator (In the code generated by Qtcreator the error does not pop-up because the erroneous code is never called). Any help is appreciated.

      Thanks

      jiancaiyangJ Offline
      jiancaiyangJ Offline
      jiancaiyang
      wrote on last edited by
      #2

      @Xavier-Thomas You may use a work-around by passing parameters to somfunc() to resolve problem temporarily. Maybe a problem with creating context being corrupted could cause properties being undefined.

      我们自己的论坛:http://qtdream.com
      擅长三维角色仿真动画。

      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