Boost logo

Boost :

Subject: [boost] [test] How to execute shell commands
From: Mike Dev (mike.dev_at_[hidden])
Date: 2018-10-17 10:34:42


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)

To fix 1) I'd need a way to get the current build directory (that is where
I want to create the __build__ directory) and the director of the current
jam file (which is where the CMakeLists.txt file resides).
That would result in something like this:

notfile run_cmake_self_test : @echo ;
actions echo
{
    mkdir $(b2-build-dir)/__build__
    cd $(b2-build-dir)/__build__
    cmake $(b2-source-dir)
    cmake --build .
}

For 2 it would be nice, if b2 had a platform agnostic way to create a directory
if it doesn't already exist so that I can just write

"<create $(b2-build-dir)/__build__ if neccesarry>"
 
notfile run_cmake_self_test : @echo ;
actions echo
{
    cd $(b2-build-dir)/__build__
    cmake $(b2-source-dir)
    cmake --build .
}

Could someone tell me how to achieve those two goals?

Best

Mike


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk