Re: [boost] [test] How to execute shell commands

Jürgen Hunold via Boost-build <[email protected]>
Newsgroups gmane.comp.lib.boost.build,gmane.comp.lib.boost.devel
Organization Privat
Message-ID <11668946.MbEDj1xXso@gonne>
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
* [email protected]             ! Germany

_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABEIAB0WIQTxeCpsgfH32pBYISlPjgiOuc/cXQUCW8dZ0AAKCRBPjgiOuc/c
XcRAAP97Be4dQM864GrxUe3idxoIEgtGM3BKb/OXwOF5tiLjhwEA1A8+rQux8Gvz
nhao3fhf4Czc5d2TVrsJDdlbGSqbDm8=
=raBH
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.