on , , , , 1 minute reading

Some time ago I wrote a small piece about using the Thread dependencies in CMake and if I remember correctly it was a little tricky to set the correct threads library (Unix systems has a pthreads library, for example). Guess what? is super easy to do it in Meson!

Let’s see the example from that post:

#include <iostream>

int main() {
std::cout << "hello concurrent world!\n";
});
t.join();
}


The Meson build file couldn’t be simpler:

project('meson_conan', 'cpp', default_options: ['cpp_std=c++17'])


Notice the dependency name should be threads, Meson will know the correct library to pick dependending on the operating system, nothing to worry about!