As far as I understand GPL, it uses the author's copyright to restrict usages of their code: Whenever someone wants to use this piece of code, he also has to publish his modifications if he distributes the resulting executable. Local modifications for your own use do not require public disclosure.

According to here, cmake works like gcc, where CmakeLists.txt ist the source code and the resulting Makefile is the resulting binary.

To my knowledge, this renders GPL on CmakeLists useless. Anyone can use CMakeLists licensed under GPL for their own project, as they will never share the resulting Makefile. Additionally, the Makefile does not contribute to the final binary the same way that my editor's programmer doesn't get to claim copyright on every piece of code I write in this editor, so the project does not need to be under GPL itself.

Surely, this is no fundamental problem: I do have the copyright for my own CMakeLists. I could come up with a new Licence, the Berne-Licence, where I state that my CMake script may only be used for GPL-Licenced Code. Is there any licence out there to fit my needs? Is there any reason why I shouldn't do that, for example compatibility reasons?

Also please feel free to correct me if some of my assumptions or conclusions are simply wrong. I have very limited experience in the copyleft / opensource ecosystem.

1 Answer 1


Firstly, the GPL requires that you distribute not only source, but also the scripts needed to build it. If the build is controlled by Makefiles, they, too must be distributed. If the Makefiles are automatically generated from some other input file then it, too, must be distributed, and all of this distribution must be under GPL.

So if you distribute your CMakeLists as part of your GPL software, and if someone takes that file, modifies and uses it to build part of their new software project, which they release with this derivative of your CMakeLists inside, I think there's an argument that the whole release will need to be under GPL. Certainly, the derivative CMakeLists will need to be under GPL.

So it's not clear to me that the problem space you ask about is all that big. Nevertheless:

I could come up with a new Licence, the Berne-Licence, where I state that my CMake script may only be used for GPL-Licenced Code.

Yes, you could, but you probably shouldn't. Firstly because crayon licences are a known problem, as is licence proliferation. But also because there have been other attempts recently to stretch the copyleft net wider than the GPL does, such as the SSPL which tries to cover the entire build architecture up to and including the software that backs up the server where the code is hosted. This has not been without criticism, such as in this talk from FOSDEM 2019 (full disclosure: I wrote the article), which shows an example of a large, GPL-tolerant company that bans from their entire environment any SSPL software, and anything covered by a Commons Clause addendum.

In short, I think the GPL already does most of what you want. What it doesn't do, I advise you against trying to do with a custom licence, or nobody will use your software, and that will defeat the objective of freeing it.

  • Thanks for the interesting article and the 'and the scripts needed to build it' question. I'm still curious regarding your claim the whole release will need to be under GPL I don't really see how one direction (you need to be able to compile the source code) influences the other direction (you may not compile non-free source code with this setup)
    – alex berne
    Apr 23, 2020 at 12:20
  • If someone takes your project, reuses some of the code in their own project, and releases it, their whole project will need to be released under GPL. I can't immediately see why the same isn't true if someone takes your project, reuses some of the build architecture in their own project, and releases it. I accept the matter is capable of argument, but it's not immediately clear to me that they don't.
    – MadHatter
    Apr 23, 2020 at 12:25
  • 2
    I also advise against abstracting the requirements of the GPL into an end you feel it's designed to fulfil, then arguing about why the end doesn't apply. Look at the requirements of the licence itself, rather than arguing from abstraction.
    – MadHatter
    Apr 23, 2020 at 12:26
  • I don't think the argument is all that strong that if you build software using a CMakeLists.txt file from a GPL repository, that your software then also must be under the GPL. I do agree that the CMakeLists.txt file itself must remain under the GPL. But it is not like the software itself contains code that can be traced back to a GPL origin. Apr 24, 2020 at 10:59
  • @BartvanIngenSchenau as I said, I accept that the matter is capable of argument. I can see arguments both pro and con, and I'd be hesitant to rush to judgement one way or the other.
    – MadHatter
    Apr 24, 2020 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.