Build Problems on Windows due to incomplete CMake configure

When you use the CMake GUI, run the configure step until all of the red items go away. If you fail to do that then you will run into issues with the projects generated from CMake on Windows. Specifically, the windows projects will contain extra truncated paths to certain Qt libraries and that will eventually cause the build to fail. If you run into this problem, go back to CMake and rerun the configure step until everything passes before you regenerate your project files. You will save yourself a lot of pain.

Filtering Script

If you run into the problem with truncated Qt paths then you can filter them out using this script:

import os, stat, string, random

root = "C:/2.7RC/build"

def tmpfilename():
    f = "temp%04d" % random.Random().randint(0,1000)
    return f

def isDir(path):
    ret = False
    try:
        s = os.stat(path)
        if (s.st_mode & stat.S_IFDIR) > 0:
            ret = True
    except:
        pass
    return ret

def FindProjects(path):
    p = []
    allfiles = os.listdir(path)
    for f in allfiles:
        filepath = os.path.join(path,f)
        if f[-8:] == ".vcxproj":
            p = p + [string.replace(filepath, "\\", "/")]
        elif isDir(filepath):
            p = p + FindProjects(filepath)
    return p

def write_filtered_line(f, line):
    toks = [";\\QtNetwork4.lib", ";\\QtCore4.lib", ";\\QtGui4.lib", ";\\QtOpenGL4.lib"]
    s = line
    count = 0
    for t in toks:
        if t in s:
            count = count + 1
            s = string.replace(s, t, "")
    f.write(s)
    return count

def FixupProject(p, overwrite):
    f = open(p, "rt")
    lines = f.readlines()
    f.close()

    tmpName = os.path.join(os.path.abspath(os.curdir), tmpfilename())
    f = open(tmpName, "wt")
    changedLines = 0
    for line in lines:
        changedLines = changedLines + write_filtered_line(f, line)
    f.close()
    if overwrite and changedLines > 0:
        os.unlink(p)
        os.rename(tmpName, p)
        print "Replaced ",p
    else:
        os.unlink(tmpName)

def main():
    proj = FindProjects(root)
    print proj
    print len(proj)
    for p in proj:
        FixupProject(p, True)

#FixupProject(root + "/vtkqt/vtkqt.vcxproj", True)
main()