Boost logo

Boost-Build :

Subject: [Boost-build] Copying file to test executable location
From: Ian Emmons (iemmons_at_[hidden])
Date: 2016-09-11 17:48:51


[I sent this question once before, but I mixed up some of the details. Sorry to not check my facts carefully enough the first time.]

I am attempting to convert a Jamfile's unit-test target into a run target, but I am having trouble getting equivalent behavior. The difficulty comes from a requirement that a certain text file be present in the same directory as the test executable. Here is a simplified version of the original, which works correctly:

  unit-test MyTest
     : [ glob *.cpp ]
       <<library-dependencies>>
     : <include>.
       <dependency>Config.txt
     : # default build
     : # usage requirements
     ;

  explicit Config.txt ;
  make Config.txt : $(SrcDir)/Config.txt : @common.copy ;

Here is my attempt using the run target:

  run [ glob *.cpp ]
       <<library-dependencies>>
     : # arguments
     : # input files
     : <include>.
       <dependency>Config.txt
     : MyTest
     : # default build
     ;

  explicit Config.txt ;
  make Config.txt : $(SrcDir)/Config.txt : @common.copy ;

Here is what goes wrong: With unit-test, the test executable is linked at this path:

.../msvc-14/release/address-model-64/threading-multi/MyTest.exe

and the config file is copied into the same directory (and therefore all is well). With the run target, the config file is copied to the same place, but the test executable is linked to a different location:

.../MyTest.test/msvc-14/release/address-model-64/threading-multi/MyTest.exe

How can I copy a file to the same directory where the run target links its executable?

Thanks in advance,

Ian


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk