Gabriel Devillers
Gabriel Devillers

Reputation: 4002

Missing builtin rules in my module Boost Build/b2/bjam

I am creating a module with name such as mymodule.jam. I cannot figure out how to use some builtin rules such as: constant or path-constant.

I get errors such as:

ERROR: rule "path-constant" unknown in module "mymodule".
ERROR: rule "constant" unknown in module "mymodule".

What is strange is that it seems I can use these rules without any problem in my jamroot or in my jamfiles, without seeming to need to import anything specific.

Upvotes: 0

Views: 124

Answers (1)

Gabriel Devillers
Gabriel Devillers

Reputation: 4002

These rules are defined in a module named project-rules from file boost-build-1_77_0/tools/build/src/build/project.jam.

I tried many things, such as:

import modules ;
modules.call-in project-rules : path-constant my_TOP_variable : . ;

and I got the following error:

error: Project target requested but not yet assigned for module 'project-rules'.

so after spending a long time trying many things, my conclusion is that these rules are available only in what the doc refers to as "Jamfile" (and not Jamfile):

When we refer to a “Jamfile,” set in normal type, we mean a file called either Jamfile or Jamroot. When we need to be more specific, the filename will be set as “Jamfile” or “Jamroot.”

because the doc for constant says (emphasis mine):

constant: Sets project-wide constant.

So not available in mymodule.jam (?).

If you find a solution, please add another answer!

Upvotes: 0

Related Questions