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

Brad King
Fri, 19 Jun 2015 12:41:14 -0000

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,
-Brad