[mythtv-users] Building using CMake??

David Hampton mythtv at love2code.net
Tue Feb 4 15:00:38 UTC 2025


On Mon, 2025-02-03 at 20:23 -0500, James Abernathy wrote:
> So I couldn't find anything interesting to read today so I read
> Mythtv/README.CMake.md.  I'm guessing that making the move to CMake
> will make it easier for developers to support different OSs and
> platforms.

It does.  From the same source tree I can build a linux version, a
variety of android versions, and a version for windows.  The only
difference to building any these versions is the argument to the "cmake
--preset" command.

> 2. If you use the default CMAKE_INSTALL_PREFIX your binaries end up
> in /usr/local/bin and your libs end up in /usr/local/lib.  However, I
> had to give my user write permission to /usr/local to make this
> happen.  I didn't want to run the build as sudo, at least I don't
> think so?

This is the same default location as for the traditional configure/make
method of building.  The difference is that the traditional method
builds everything first and installs everything last, where the cmake
method builds and installs each part, and then moves on to the next
part.  You change the default location in the traditional method by
passing the --prefix argument to "configure", you change it in the
cmake method by passing the -DCMAKE_INSTALL_PREFIX argument to the
"cmake --preset" command.

Building MythTV from five sub-projects (28 on android, 30 on windows)
is the way to have the same command invocation no matter what you are
building.  Each sub-project needs to build then install, so that its
results can be found by the next sub-project's configuration step.

I'm not sure how other developers are handling the change to have
multiple installs as part of the build.  I have always installed my
test builds into a temporary directory underneath my home directory and
run them from there, so this wasn't an issue for me.  Running directly
from a temporary location should be a matter of setting the PATH and
LD_LIBRARY_PATH variables appropriately.   If you really want to run
out of /usr/local, one solution might be to first install into a
temporary directory and then use a "sudo rsync" command to copy
everything into /usr/local.  Hopefully others will chime in on what
they are doing.

I still do my production builds using Gary's script to build a set of
Fedora rpms, which I then copy to my production systems.

David



More information about the mythtv-users mailing list