HomePhabricator

Use the correct Python lib for each build configuration generated by the Visual…

Authored by brucem on Oct 1 2015, 12:47 AM.

Description

Use the correct Python lib for each build configuration generated by the Visual Studio CMake generator

Summary:
Previously CMAKE_BUILD_TYPE was used to determine whether to link in python27.lib or python27_d.lib, unfortunately this only works reliably when using a CMake generator that generates a single build configuration (e.g. Ninja). The Visual Studio CMake generator generates four build configurations at once (Debug, Release, RelWithDebInfo, MinSizeRel), so if CMAKE_BUILD_TYPE is set to Debug all four build configurations end up linking in python27_d.lib, this is clearly undesirable.

To ensure that the correct Python lib is used for each build configuration the value of PYTHON_LIBRARY is now determined using generator expressions that evaluate to either the debug or release Python lib. The values of PYTHON_EXECUTABLE and PYTHON_DLL are now likewise determined using generator expressions.

Note that these changes only apply to the Windows build.

Patch by Vadim Macagon. Thanks!

Reviewers: zturner, brucem

Subscribers: zturner, lldb-commits

Differential Revision: http://reviews.llvm.org/D13234

llvm-svn: 248991