craftr-build / craftr-build-4.x

Frontend for the Craftr build framework.
https://craftr-build.github.io/craftr/
Other
60 stars 14 forks source link

c_compile()/cpp_compile() doesn't place files into build tree when sources are outside of the project directory #154

Closed NiklasRosenstein closed 7 years ago

NiklasRosenstein commented 7 years ago

If you have source files outside of the project directory and compile them with c_compile() or cxx_compile(), the objects will be created in the same directory as their source files.

The implementations use the relocate_files() built-in to create the object filenames in the build tree from the source files in the project tree. Since it uses the project directory as the base, but the source files are outside of the parent directory, the output filenames will not be "relocated" to the build directory.

To fix this, we must pass the parent argument to relocate_files(), but that also means that the user must pass a parent_dir argument to c_compile() and cpp_compile().

NiklasRosenstein commented 7 years ago

See https://github.com/craftr-build/craftr/commit/3ea6d29dc3859e60cc291a1f2580a589691b9961