[LLVMdev] [CMake] Generated LLVMConfig.cmake and LLVMExports.cmake broken under Visual Studio 2015

Dan Liew dan at su-root.co.uk
Fri Jun 19 15:08:27 PDT 2015


On 19 June 2015 at 05:41, Brad King <brad.king at kitware.com> wrote:
> On 06/18/2015 06:46 PM, Dan Liew wrote:
>>> The issue is the that that generated LLVMExports.cmake file has this in it
>>>   INTERFACE_LINK_LIBRARIES "LLVMObject;LLVMSupport;C:\Program Files (x86)\Microsoft Visual Studio 14.0\DIA SDK\lib\diaguids.lib"
>>
>> Hmm actually this might be a bug in the
>> ``/lib/DebugInfo/PDB/CMakeLists.txt`` file. CC'ing Zach Turner seeing
>> as he appears to be the author.
>>
>> -  set(LIBPDB_ADDITIONAL_LIBRARIES "${LIBPDB_LINK_FOLDERS}\\diaguids.lib")
>> +  file(TO_CMAKE_PATH "${LIBPDB_LINK_FOLDERS}\\diaguids.lib" LIBPDB_ADDITIONAL_LIBRARIES)
>
> That should resolve the issue for LLVM with no changes to CMake.

> However, CMake should also be taught to escape the backslashes correctly
> when generating the export files.  Take a look at
>
>  Source/cmExportFileGenerator.cxx
>  Source/cmExportBuildFileGenerator.cxx
>  Source/cmExportInstallFileGenerator.cxx
>
> in the CMake source tree.  There are several places that just generate
> double quotes around a raw value that should instead use EscapeForCMake.
>

Thanks for the explanation. Would you like me to file a bug on the
CMake bug tracker?
Alternatively I could try writing a patch but I don't really know what
I'm doing.

Did you have any thoughts on the other issue I saw which was paths
containing "$(Configuration)". E.g.

```
set(LLVM_TOOLS_BINARY_DIR
"C:/Users/alexander.APRELEV/Documents/halide/llvm-build/$(Configuration)/bin")
```

I have a feeling that this something to do with using Visual Studio as
a generator. When using ninja/CMake there is only a single build
configuration but when using the Visual Studio CMake generator it
seems there are multiple configuration present at the same time. I
noticed this because I tried to hack around the issue by reading the
LOCATION property of one of the llvm executable targets. This didn't
work very well and I discovered that LLVMExports.cmake has multiple
locations for the same target.

Thanks,
Dan.



More information about the llvm-dev mailing list