There are two ways to reduce the dependencies in CMT:

  • put the "use" statement in a private section
  • append the qualifier -no_auto_imports

We need to consider both compile/link time dependencies, and run-time. Many packages, like flux, have xml files in the package that need to be made visible at run time, but compile-time resources like header files and libraries are only needed by packages that build against it. So flux has the following statement:

# default path to xml files
 set FLUX_XML "$(flux_root)/xml"

 

This defines the enviroment variable FLUX_XML which will be set by the setup.* script in the cmt folder of any package that depends on flux via a public path.

But to avoid adding the include path and link options to clients of such a package,  FluxSvc, for example, has the following statement:

 

use flux * -no_auto_imports

 

But this applies to FluxSvc as well, so the statement to build the FluxSvc library must have the qualifier

 

-import=flux

 

The full command is:

private

 macro source ".cxx" WIN32 ".h *.cxx *.txt"

 #these need to be explicily imported since we use -no_auto_imports  for the used packages

 macro library_imports "-import=flux -import=tip -import=GRB -import=celestialSources  -import=f2c -import=eblAtten"

 -s=../FluxSvc $(source) \
 -s=Dll *.cxx\library FluxSvc $(library_imports) \
 -s=../src $(source)

 

  • No labels