|
Boost : |
Subject: Re: [boost] [test] How to execute shell commands
From: Jürgen Hunold (jhunold_at_[hidden])
Date: 2018-10-17 15:48:32
Hi Mike,
first thing is that you got the wrong mailing list and the wrong [library]
tag. This really is a Boost.Build question and belongs on its mailing list. So
I crossposted your question there.
And as this is not a Boost.Test question, [test] is also misleading.
Beyond that, I can at least answer how to get the current Jamfile directory,
see below.
Am Mittwoch, 17. Oktober 2018, 12:34:42 CEST schrieb Mike Dev via Boost:
> 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).
In the current Jamfile you can use
path-constant CWD : . ;
to store the current directory "." into a variable named CWD. Or whatever name
you like.
> 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 .
> }
I see what you want.
> 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?
I hope someone with more active b2 knowledge can.
Yours,
Jürgen
-- * Dipl.-Math. Jürgen Hunold ! * voice: ++49 4257 300 ! Fährstraße 1 * fax : ++49 4257 300 ! 31609 Balge/Sebbenhausen * jhunold_at_gmx.eu ! Germany
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk