Menu

#25 Relative paths for source files issue

New
nobody
None
Medium
Defect
2013-07-03
2013-07-03
Anonymous
No

Originally created by: stahlber... (code.google.com)@gmail.com

What steps will reproduce the problem?

If you have separated Visual Studio's project and source files into different folders the object and definition files will not be generated with valid names.

Example) Say source is located "../src/foobar.c"

the generated make file will try to output "gccDebug/../src/foobar.o" which does not work.

Quick fix I did for this is by modifying the MakeItSo source in MakefileBuilder_Project_CPP.cs (I'm using a C framework) and stripping the relative path component from the target files by:

foreach (string filename in m_projectInfo.getFiles())
{
    var fileNameOnly = Path.GetFileName(filename);
    string path = String.Format("{0}/{1}", intermediateFolder, fileNameOnly);
    string objectPath = Path.ChangeExtension(path, ".o");
...

and further down

foreach (string filename in m_projectInfo.getFiles())
{
    // We work out the filename, the object filename and the
    // dependencies filename...
    var fileNameOnly = Path.GetFileName(filename);
    string path = String.Format("{0}/{1}", intermediateFolder, fileNameOnly);
    string objectPath = Path.ChangeExtension(path, ".o");
    string dependenciesPath = Path.ChangeExtension(path, ".d");
...

Discussion


Log in to post a comment.

MongoDB Logo MongoDB