diff options
author | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-08-26 12:20:42 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-08-28 14:34:32 -0500 |
commit | c68977cffadf47d072e1c90903d5aee9a39541f9 (patch) | |
tree | cd66c7c209e23d4f4cd0017811c669dd5e9cd849 /host/python | |
parent | da1aeaeccc3e1790d6c4fc5573c3aa713d3487fb (diff) | |
download | uhd-c68977cffadf47d072e1c90903d5aee9a39541f9.tar.gz uhd-c68977cffadf47d072e1c90903d5aee9a39541f9.tar.bz2 uhd-c68977cffadf47d072e1c90903d5aee9a39541f9.zip |
cmake: Use relative path to Python lib location for Windows installer
Diffstat (limited to 'host/python')
-rw-r--r-- | host/python/CMakeLists.txt | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt index 04e637f2e..dfe049b87 100644 --- a/host/python/CMakeLists.txt +++ b/host/python/CMakeLists.txt @@ -98,11 +98,23 @@ else() # Otherwise, use distutils to determine the correct relative path for Python # packages, and install to our prefix if(NOT DEFINED UHD_PYTHON_DIR) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c - "from distutils import sysconfig;\ - print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'));" - OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE - ) + if(WIN32) + # CPack with NSIS generates an error when using install() + # with a DESTINATION that is an absolute path. Thus, specify + # a blank prefix, which returns only the Python library relative + # path, and use that in the install step below. + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c + "from distutils import sysconfig;\ + print(sysconfig.get_python_lib(plat_specific=True, prefix=''));" + OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE + ) + else() + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c + "from distutils import sysconfig;\ + print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'));" + OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif(WIN32) endif(NOT DEFINED UHD_PYTHON_DIR) file(TO_CMAKE_PATH ${UHD_PYTHON_DIR} UHD_PYTHON_DIR) |