From 4c65204e52db0da1ebf0c0a323b4de1f80e55f12 Mon Sep 17 00:00:00 2001 From: gnieboer <gnieboer@corpcomm.net> Date: Sun, 2 Jun 2019 09:07:19 -0400 Subject: CMake: Fixes error when both debug and release python libraries are installed --- cmake/Modules/GrPython.cmake | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'cmake/Modules') diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake index b023be2619..38ebb4dd30 100644 --- a/cmake/Modules/GrPython.cmake +++ b/cmake/Modules/GrPython.cmake @@ -54,10 +54,20 @@ set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") set(QA_PYTHON_EXECUTABLE ${QA_PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter for QA tests") add_library(Python::Python INTERFACE IMPORTED) -set_target_properties(Python::Python PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${PYTHON_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${PYTHON_LIBRARIES}" - ) +# Need to handle special cases where both debug and release +# libraries are available (in form of debug;A;optimized;B) in PYTHON_LIBRARIES +if(PYTHON_LIBRARY_DEBUG AND PYTHON_LIBRARY_RELEASE) + set_target_properties(Python::Python PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PYTHON_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:Debug>>:${PYTHON_LIBRARY_RELEASE}>;$<$<CONFIG:Debug>:${PYTHON_LIBRARY_DEBUG}>" + ) +else() + set_target_properties(Python::Python PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PYTHON_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${PYTHON_LIBRARIES}" + ) +endif() + ######################################################################## # Check for the existence of a python module: -- cgit v1.2.3