C++ Logo

sg15

Advanced search

Re: [Tooling] Modules

From: Bill Hoffman <bill.hoffman_at_[hidden]>
Date: Fri, 1 Feb 2019 12:23:24 -0500
Except for toy projects, you need to tell the compiler what files will
go into which libraries and executables. You could point a compiler at a
file with main in it and have it figure out everything that is used by
that main and build a single executable. However, breaking code down
into libraries and deciding if the libraries are shared, static,
dynamically loaded is something the developer is going to need to
control. If you use an IDE it is done by drag and drop with a graphical
interface. If you use CMake it is done by listing the sources you want
for each library or executable in the CMake file. Basically you need to
partition the set of source files into a set of products from the
compiler. Any build tool or IDE is going to have to do this. I think it
would be a huge step backwards to ask users to also specify the include
depends and the module depends. In CMake we have had Fortran working for
years now. You list all the Fortran files you want in a product and
CMake parses the Fortran to figure out the build order defined by the
producers and consumers of modules in the set of Fortran files it was
given. In practice with Fortran users having to figure out the correct
order of module builds resulted in people running make over and over
until all the modules were produced and the code compiled unless they
use a tool like CMake.

-Bill

Received on 2019-02-01 18:22:56