cmake question and [PATCH] for Undefined symbol "_liblldb_coreVersionString"

Due to recent changes, rebuilding with cmake and ninja in an existing build on
OSX gets the following linker errors (note: it builds fine from scratch):

    $ ninja
    . . .
    Undefined symbols for architecture x86_64:
    "_liblldb_coreVersionString", referenced from:
        lldb_private::GetVersion() in lldb.cpp.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    . . .
    ninja: build stopped: subcommand failed.

I've tried to fix this wirth the attached patch, but it gets a warning about
multiple rules for LLDB_vers.c:

    $ ninja
    [1/1] Re-running CMake...
    . . .
    ninja: warning: multiple rules generate tools/lldb/source/LLDB_vers.c. builds involving this target will not be correct; continuing anyway
    . . .
    [13/13] Creating executable symlink bin/lldb

Does anyone know how to fix this the right way to avoid these warnings?

BTW, anyone know why I also get the following warnings? (They are unrelated to
the linker error or the patch, but just curious):

    . . .
    [6/13] Linking CXX shared library lib/liblldb.3.8.0.dylib
    ld: warning: cannot export hidden symbol lldb::SBListener::GetSP() from tools/lldb/source/API/CMakeFiles/liblldb.dir/SBAttachInfo.cpp.o
    ld: warning: cannot export hidden symbol lldb::SBListener::GetSP() from tools/lldb/source/API/CMakeFiles/liblldb.dir/SBLaunchInfo.cpp.o
    . . .
    ld: warning: cannot export hidden symbol lldb::endian::InlHostByteOrder() from lib/liblldbExpression.a(IRForTarget.cpp.o)
    [13/13] Creating executable symlink bin/lldb

Thanks in advance,
-Dawn

lldb_link_fix.patch (591 Bytes)

If I remember correctly the CMake stuff relating to LLDB_vers.c is kind of confusing. I can have a look when I’m back in the office on Monday if nobody else beats me.