Boost logo

Boost :

Subject: Re: [boost] [test] How to execute shell commands
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-10-17 17:19:25


On 10/17/2018 04:34 AM, Mike Dev via Boost wrote:
> OK, what I got from the documentation is that I can do something like
> notfile run_cmake_self_test : @echo ;
> actions echo
> {
> mkdir __build__
> cd __build__
> cmake ..
> cmake --build .
> }
> but
> 1) this will create __build__ in whatever directory b2 is called from and
> require the test cmake file to be in the parent directory of the current
> 2) mkdir will fail if the directory already esists and the flags necessary
> to circumvent that are different on powershell (--force) and bash (-p)

I would recommend using a make target (warning untested):

make CMakeCache.txt : CMakeLists.txt : @echo ;
always CMakeCache.txt ;

actions echo
    cmake -S "$(>:D)" -B $(<:D)
    cmake --build "$(<:D)"

Note 1: The directory will be created automatically.
Note 2: Avoiding cd simplifies the path handling a lot.
Note 3: This could probably be split into two separate actions.

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at