installationmeson-buildbuildconfiguration

What is the meson equivalent of CMAKE_INSTALL_PREFIX?


I'm using to building code with CMake; but I'm now faced with using meson to build a certain repository. With CMake and make, if I use something like:

cmake -DCMAKE_INSTALL_PREFIX=/some/where` build_dir
make -C build_dir
make -C build_dir install

then instead of the files going under /usr/local by default, they will go under /some/where, e.g. /some/where/bin for executables, /some/where/lib, for libraries etc.

What's the meson equivalent of doing this?

Inspired by:
What is CMake equivalent of 'configure --prefix=DIR && make all install '?


Solution

  • It's actually similar to the autotools convention in terms of the switch:

    meson setup --prefix=/path/of/installation/destination build_dir
    ninja -C build_dir
    ninja -C build_dir install
    

    (you could drop the first ninja command; ninja install will build before it installs.)