Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8902055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:31:03+00:00 2026-06-15T01:31:03+00:00

I have set up a project on top of Qt (so source is written

  • 0

I have set up a project on top of Qt (so source is written in C++) and I wanted to try Gradle for automatic builds on that. It took me some time to get into the details of configuring a multi project build (there is an executable and two libs) and now I am trying to tell the cpp-exe and the cpp-lib plugin how my source tree is structured.

I have set up a task that should print all of the source sets (there should be at least the default ones right?) and it looks like this:

task projectinfo {
description = "Informations about the current project"
group = INFORMATIONS_GROUP

doFirst {
    task -> print ("""${task.project.sourceSets.all}""")
}

If I run this task Gradle tells me that there is no property “sourceSets” for the project. The documentation of the plugin tells me that it is possible to customize the source locations, but not how.

So my question would be: How can I tell the Gradle cpp plugin which source files to use. If there is any documentation about the cpp plugin apart from its API documentation and the Gradle user guide that would be helping too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:31:05+00:00Added an answer on June 15, 2026 at 1:31 am

    Have a look at Adam Murdoch’s usage of Gradle’s ‘cpp plugin’. I believe he’s one of the main Gradle submitters, so he should know how to use this better than anyone:

    Exert from native-platform/build.gradle

    cpp {
        sourceSets {
            main {
                source.exclude 'curses.cpp'
            }
            curses {
                source.srcDirs = ['src/main/cpp']
                source.include 'curses.cpp'
                source.include 'generic.cpp'
                source.include 'generic_posix.cpp'
            }
        }
    }
    
    Then, within the 'libraries' node, refer to all/any combination of architecture and source sets:
    
    sourceSets << cpp.sourceSets.main
    sourceSets << cpp.sourceSets.curses
    

    I’ve not had too long to look over it myself, but it looks like he defines a number of OS architecture based source code include combinations and stores these in the variants variable. He then processes them into platform JARs (I haven’t actually ran the build yet, maybe I should).

    Also, take a look at https://github.com/rklaren/GradleJNI, it uses the cpp plugin but looks to be a little Windows-oriented.

    Update – I also found https://github.com/alkemist/gradle-cpp-demo, which has an example of the ‘cpp-exe’ plugin building an executable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HI, I want to have set configuration settings for a unit test project that
I have a NetBeans project set up with a bunch of source classes and
I have a project set up like this; Project -src -com -top -classes Class_3.java
I have begun work on a personal project that may end up having some
I have some elisp files in a project that I want to byte compile
I have been set a project from school to design snake in VB.Net but
I have set up my maven project using the m2e plugin in eclipse indigo,
I have set up a BlackBerry Cascades-UI project. I am using QML to define
I have set up a few models in a simple django project. When I
I have Visual Studio 2003 project and I have set all of the AssemblyInfo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.