Brad King
2015-Jun-19 12:41 UTC
[LLVMdev] [CMake] Generated LLVMConfig.cmake and LLVMExports.cmake broken under Visual Studio 2015
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
Alexander Aprelev
2015-Jun-19 19:13 UTC
[LLVMdev] [CMake] Generated LLVMConfig.cmake and LLVMExports.cmake broken under Visual Studio 2015
FYI, llvm/clang r240139 with Dan's patch seems to build fine on Windows with VS2015. ________________________________________ From: llvmdev-bounces at cs.uiuc.edu <llvmdev-bounces at cs.uiuc.edu> on behalf of Brad King <brad.king at kitware.com> Sent: Friday, June 19, 2015 8:41 AM To: Dan Liew; LLVM Developers Mailing List Cc: aam at google.com Subject: Re: [LLVMdev] [CMake] Generated LLVMConfig.cmake and LLVMExports.cmake broken under Visual Studio 2015 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 _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Dan Liew
2015-Jun-19 21:55 UTC
[LLVMdev] [CMake] Generated LLVMConfig.cmake and LLVMExports.cmake broken under Visual Studio 2015
On 19 June 2015 at 12:13, Alexander Aprelev <alexander at aprelev.com> wrote:> FYI, llvm/clang r240139 with Dan's patch seems to build fine on Windows with VS2015.Thanks for testing. I've committed my patch in r240181.
Dan Liew
2015-Jun-19 22:08 UTC
[LLVMdev] [CMake] Generated LLVMConfig.cmake and LLVMExports.cmake broken under Visual Studio 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.
Brad King
2015-Jun-22 13:01 UTC
[LLVMdev] [CMake] Generated LLVMConfig.cmake and LLVMExports.cmake broken under Visual Studio 2015
On 06/19/2015 06:08 PM, Dan Liew wrote:>> However, CMake should also be taught to escape the backslashes correctly >> when generating the export files. Take a look at > > 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.Please bring the issue over to the cmake developers' list because such discussion will be more relevant there.> 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") > ```This is indeed for multi-configuration generators like Visual Studio. Paths like this are meant only for reference in the build system files. The $(Configuration) placeholder will be replaced by the native build system tools (like msbuild) at build time. Generally these paths should not be exported from a project install tree but may be from its build tree. Any code path that needs to get one of these directories for use somewhere other than build system files must choose a specific configuration to get the corresponding path. The LOCATION_<CONFIG> target property or the $<TARGET_FILE:...> generator expression can be used to reference them. The latter can be used with commands like file(GENERATE) to write into external files. -Brad