summaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorgnieboer <gnieboer@corpcomm.net>2019-06-02 09:07:19 -0400
committerMartin Braun <martin.braun@ettus.com>2019-06-15 16:50:03 -0700
commit4c65204e52db0da1ebf0c0a323b4de1f80e55f12 (patch)
tree423a27866792fb9ba1778931b7c0eb06d2407e7b /cmake/Modules
parent9d2199a95457d66c2208f7ae4300eb60b1deadf9 (diff)
CMake: Fixes error when both debug and release python libraries are installed
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/GrPython.cmake18
1 files changed, 14 insertions, 4 deletions
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: