Ugh, this sounds really familiar. NVScript had similar issues.
It's been years and I don't remember the particulars, but I believe I ended up asking someone who was more familiar with the whole C++ build process about this, and they helped me "solve" it by converting NVScript into an MSVC project, bypassing the entire problem.