[cfe-dev] LibTooling with NMake Makefiles (Windows)
Jay Mattis
jaymattis at gmail.com
Fri Oct 19 14:33:58 PDT 2012
Hi everyone,
I'm VERY new to all of the LibTooling stuff. I just thought I'd check
it out yesterday and I found the following issue. I don't know if this
is me doing something wrong or what, but...
I wanted to use LibTooling on Windows with a generic project. I
created a single directory as a test that just had input_test.cpp
which basically contained only an empty main function. Then, I created
a CMakeLists.txt file for it. I understand that the next step is
creating the .json file (this is the part where I suspect maybe
there's a better way?), so I tried using
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON. This didn't export any json since
it was building a Visual Studio project. So, I used -g "NMake
Makefiles". This seemed to successfully export the .json file.
However, I got all kinds of errors when trying to use LibTooling on
it. The reason is that it generated a json file that looked like this:
[
{
"directory": "C:/path/to/project",
"command": "C:\\PROGRA~2\\MICROS~2.0\\VC\\bin\\cl.exe @<<
/nologo -g -Wall /MD /O2 /Ob2 /D NDEBUG
-IC:\\path\\to\\project\\$(INPUTTEST_SOURCE_DIR) /TP
/FoCMakeFiles\\inputtest.dir\\inputtest.obj
/FdC:\\path\\to\\project\\inputtest.pdb -c
C:\\path\\to\\project\\inputtest.cpp
<<",
"file": "C:/path/to/project/inputtest.cpp"
}
]
When I modified the .json file manually to look this, it worked:
[
{
"directory": "C:/path/to/project",
"command": "C:/PROGRA~2/MICROS~2.0/VC/bin/cl.exe /nologo -g -Wall
/MD /O2 /Ob2 /D NDEBUG -IC:/path/to/project/$(INPUTTEST_SOURCE_DIR)
/TP /FoCMakeFiles/inputtest.dir/inputtest.obj
/FdC:/path/to/project/inputtest.pdb -c
C:/path/to/project/inputtest.cpp",
"file": "C:/path/to/project/inputtest.cpp"
}
]
I don't know what the whole multi-line @<< stuff is about but that
seems to be what's causing the issue. Does anyone else have any
experience with this or a better way for me to set this up?
More information about the cfe-dev
mailing list