<div dir="ltr">Ok, looks good</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 30, 2015 at 12:27 AM Vadim Macagon <<a href="mailto:vadim.macagon@gmail.com">vadim.macagon@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">enlight updated this revision to Diff 36072.<br>
enlight added a comment.<br>
This revision is now accepted and ready to land.<br>
<br>
Added an explanation of the generator expression used in this patch.<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D13234" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13234</a><br>
<br>
Files:<br>
  cmake/modules/LLDBConfig.cmake<br>
<br>
Index: cmake/modules/LLDBConfig.cmake<br>
===================================================================<br>
--- cmake/modules/LLDBConfig.cmake<br>
+++ cmake/modules/LLDBConfig.cmake<br>
@@ -48,15 +48,39 @@<br>
   if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")<br>
     if (NOT "${PYTHON_HOME}" STREQUAL "")<br>
       file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME)<br>
-      if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")<br>
-        file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_EXECUTABLE)<br>
-        file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" PYTHON_LIBRARY)<br>
-        file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DLL)<br>
-      else()<br>
-        file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_EXECUTABLE)<br>
-        file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" PYTHON_LIBRARY)<br>
-        file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_DLL)<br>
-      endif()<br>
+      file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_DEBUG_EXE)<br>
+      file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" PYTHON_DEBUG_LIB)<br>
+      file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DEBUG_DLL)<br>
+<br>
+      file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE)<br>
+      file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" PYTHON_RELEASE_LIB)<br>
+      file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_RELEASE_DLL)<br>
+<br>
+      # Generator expressions are evaluated in the context of each build configuration generated<br>
+      # by CMake. Here we use the $<CONFIG:Debug>:VALUE logical generator expression to ensure<br>
+      # that the debug Python library, DLL, and executable are used in the Debug build configuration.<br>
+      #<br>
+      # Generator expressions can be difficult to grok at first so here's a breakdown of the one<br>
+      # used for PYTHON_LIBRARY:<br>
+      #<br>
+      # 1. $<CONFIG:Debug> evaluates to 1 when the Debug configuration is being generated,<br>
+      #    or 0 in all other cases.<br>
+      # 2. $<$<CONFIG:Debug>:${PYTHON_DEBUG_LIB}> expands to ${PYTHON_DEBUG_LIB} when the Debug<br>
+      #    configuration is being generated, or nothing (literally) in all other cases.<br>
+      # 3. $<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_LIB}> expands to ${PYTHON_RELEASE_LIB} when<br>
+      #    any configuration other than Debug is being generated, or nothing in all other cases.<br>
+      # 4. The conditionals in 2 & 3 are mutually exclusive.<br>
+      # 5. A logical expression with a conditional that evaluates to 0 yields no value at all.<br>
+      #<br>
+      # Due to 4 & 5 it's possible to concatenate 2 & 3 to obtain a single value specific to each<br>
+      # build configuration. In this example the value will be ${PYTHON_DEBUG_LIB} when generating the<br>
+      # Debug configuration, or ${PYTHON_RELEASE_LIB} when generating any other configuration.<br>
+      # Note that it's imperative that there is no whitespace between the two expressions, otherwise<br>
+      # CMake will insert a semicolon between the two.<br>
+<br>
+      set (PYTHON_EXECUTABLE $<$<CONFIG:Debug>:${PYTHON_DEBUG_EXE}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_EXE}>)<br>
+      set (PYTHON_LIBRARY $<$<CONFIG:Debug>:${PYTHON_DEBUG_LIB}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_LIB}>)<br>
+      set (PYTHON_DLL $<$<CONFIG:Debug>:${PYTHON_DEBUG_DLL}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_DLL}>)<br>
<br>
       file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIR)<br>
       if (NOT LLDB_RELOCATABLE_PYTHON)<br>
<br>
<br>
</blockquote></div>