r/cpp • • Oct 06 '26

University of Waterloo user study on understanding CMake changes

Hi everyone,

I’m Mattie Nejati, a Ph.D. candidate at the University of Waterloo. I’m conducting a user study on understanding the impact of changes to CMake build specifications, and I’d love to invite members of this community to participate.

We are evaluating a new approach that aims to help developers identify how a change to a CMake build specification affects the resulting build configuration.

The study:

  • is conducted entirely online;
  • takes about one hour;
  • involves inspecting changes to CMake build specifications and identifying their impact; and
  • is open to adults aged 18–64 with any level of experience in CMake, programming, or code review.

You do not need to be a CMake expert. We are specifically interested in comparing participants with different levels of experience.

You will need a computer with internet access and about 4 GB of free space to download the files required for the tasks.

We will not collect your name. Your email address will only be used for study follow-up and will be stored separately from your study data. Your name or email will not appear in any dataset or publication.

The study has received clearance from the University of Waterloo Research Ethics Board (REB #46621).

If you’re interested, you can find the consent form, screening questionnaire, and study here:

https://buiscout.cs.uwaterloo.ca/

Thank you very much! And if you know someone else who works with CMake who might be interested, I’d really appreciate you sharing the study with them.

56 Upvotes

59 comments sorted by

View all comments

Show parent comment

1

u/TheRavagerSw Oct 07 '26

If you want monolithic cross language builds isn't bazel a better option? I know google uses rust code in skia.

I envision a future of multiple build systems and tooling with a single packaging format and a single package manager.

I guess you guys saw it too, since you released CPS. Even if it fails, the idea is there.

1

u/not_a_novel_account cmake dev Oct 07 '26

If you want monolithic cross language builds isn't bazel a better option?

You have some Fortran code you build with flang, and you have some C++ code you build with clang++.

Which do you use to link the final binary? flang or clang++? Because neither will work out of the box.

1

u/TheRavagerSw Oct 07 '26

Can you elaborate please?

2

u/not_a_novel_account cmake dev Oct 07 '26

The question is the elaboration.

program main
  use iso_c_binding
  implicit none

  interface
    subroutine cpp_hello() bind(C)
    end subroutine
  end interface

  print *, "Fortran calling C++..."
  call cpp_hello()
end program

#include <iostream>
#include <vector>

extern "C" void cpp_hello() {
  std::vector<int> xs{1, 2, 3};
  std::cout << "C++ says: " << xs.size() << '\n';
}

Ok, you compile with:

flang -c main.f90 -o main.o
clang++ -c hello.cpp -o hello.o

Which do you use to run the link step? flang? Which doesn't know about the C++ runtime or other implicit flags. Or clang++? Which doesn't know about the Fortran runtime or other implicit link flags.

This gets 10x more complicated once you introduce languages which require device finalization or have other link wrapper requirements.

1

u/TheRavagerSw Oct 07 '26 edited Oct 07 '26

Indeed it is a complicated problem, But isn't the current approach is to use C as the common API, so final link is any language + C libraries?

So the scope becomes no different than using system C libraries which every language supports.

For your use case I have no clue though. I only ever used C as the glue. For rust libraries they use C/C++ compiler as the linker driver so everything just works, I can link my own C++ STL override allocator with mimalloc etc without difficulty.

3

u/not_a_novel_account cmake dev Oct 07 '26

We're already using C as the common API here. Note the extern "C" and use_iso_c_binding.

This is a good illustration of the point of CMake, you don't even understand the problem because it's irrelevant to you. But for some people, this problem plagued them for a decade before CMake came along.

2

u/TheRavagerSw Oct 07 '26

I see. Wish I could discuss this but my knowledge is pretty limited compared to you in this area. Thanks for the point.

1

u/not_a_novel_account cmake dev Oct 07 '26

I missed the edit. In rust the crate is the translation unit, and there is no separate runtime library. Rust doesn't have this problem when linked into other languages. Rust is the odd man out here. But the fact you're using the C++ driver for the final link is actually the point, if you had tried to use rustc or clang (ie, not clang++) it wouldn't have worked even if all your C++ code was in extern c++ functions.

Something has to link the C++ runtime. Now for you in particular this usually means explicitly specifying all of that, but for people who want builds that work on a variety of compilers and build environments, that's not an option.