[PATCH] D133482: [LLVM] Fix GetErrcMessages.cmake module for WoA

Muhammad Omair Javaid via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 03:24:49 PDT 2022


omjavaid created this revision.
Herald added subscribers: mstorsjo, kristof.beyls, mgorny.
Herald added a project: All.
omjavaid requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

GetErrcMessages.cmake module makes use of cmake's try_run which by
default builds its sources in debug mode unless configured with
CMAKE_TRY_COMPILE_CONFIGURATION. Debug builds on Windows sometimes fail
when appropraite DLLs are not included in path. Also on Windows on Arm
machines debug builds sometimes fail to link the correct debug DLLs.

To fix this I am setting CMAKE_TRY_COMPILE_CONFIGURATION to active build
configuration of currently configured LLVM project. This makes sure we
select same build type for try_run/try_compile cmake modules as
currently configured LLVM project.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133482

Files:
  llvm/cmake/modules/GetErrcMessages.cmake


Index: llvm/cmake/modules/GetErrcMessages.cmake
===================================================================
--- llvm/cmake/modules/GetErrcMessages.cmake
+++ llvm/cmake/modules/GetErrcMessages.cmake
@@ -29,6 +29,9 @@
         }
     ")
 
+    # try_run uses Debug build by default. Set it to LLVM project's build type.
+    set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
+
     try_run(errc_exit_code
             errc_compiled
             ${CMAKE_BINARY_DIR}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133482.458696.patch
Type: text/x-patch
Size: 478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220908/a883d63d/attachment.bin>


More information about the llvm-commits mailing list