tags:

views:

558

answers:

1

Adding source files more than one directory away (e.g. ../../source.cpp or ../../../somewhere_else/source.cpp, vs. just source.cpp or ../source.cpp) to the SOURCES= declaration in a WDK/DDK build yields the following error:

Ignoring invalid directory prefix in SOURCES= entry

Is it possible to include remote source files in a build?

+1  A: 

It is not possible to do this directly. build is explicitly designed only to deal with source code in the same or parent directory of the sources file. It cannot use source files from arbitrary locations. In particular, its dependency-tracking system seems unable to parse and track remote files, and therefore it explicitly checks and enforces that all files be local.

There are two common solutions:

  1. Build remote code as a separate lib (either via another subproject/directory in the same build project, or using an independent build step).

  2. Place a local stub for each remote source file which does #include "../../remote_source.cpp, and add this local stub to the SOURCES= list, instead. This will work, but build/nmake will not track dependencies in the remote_source.cpp. If remote_source.cpp changes, you will have to either touch the local proxy source, or otherwise force a rebuild (delete the local proxy obj, run build with -cZ, or otherwise).

jrk