I have a C++/MFC app that I am trying to make more portable in preparation for cross-platform conversion to something like wxWidgets.
My first step was to identify all of its compiler and linker dependences, such as the CRT library, Windows SDK, and MFC, and collect these together in the same filestore as the project, so that the whole package would be independent of any particular working environment (WinSDK version, etc) that might vary from one computer to another.
For compiler dependencies, this was relatively easy. By using the (/X) option
Project > Properties > C/C++ > Preprocessor > Ignore Standard Include Path
I was able to detach the project from the default include folders defined in
Tools > Options > Projects and Solutions > VC++ Directories
This of course generated a slew of compilation errors, and by transferring all of these required libraries to my filestore and adding their new paths manually to the
Project > Properties > C/C++ > General > Additional Include Directories
I was able to ensure that I had my own copy of everything the compiler depends on for my project.
However, for the linker it was not so easy. While it does have the option
Project > Properties > Linker > General > Additional Library Directories
for adding the custom dependencies, I could not find a way to get the linker to ignore the standard library paths to help me identify these dependencies.
All I could find was
Project > Properties > Linker > Input > Ignore All Default Libraries
but this is not the same thing at all. It just causes the linker to ignore the pragmas in the headers that specify which library files should be linked to, but leaves the standard library paths available for the linker to search.
In the end, I had to go back to
Tools > Options > Projects and Solutions > VC++ Directories
and delete all of the "Library files" directories to ensure I was not inadvertently overlooking a dependency. This of course now makes VS2008 unable to build other projects, where I am not trying to achieve the same type of dependency isolation.
It seems odd that the compiler has this useful override switch (/X) for disabling standard environment paths, but the linker does not.
Can anyone shed light on this? Or am I missing something?