diff options
author | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-01-06 13:01:32 -0600 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-01-14 14:36:39 -0600 |
commit | 6d746fd2963a8461cb38efb4189388f96bf1f93e (patch) | |
tree | 683bb8f5d724c264e98ca2aa7639153feac7e534 /host/CMakeLists.txt | |
parent | 88d284816e8e91dda17b7a3edcbdfeec89de4843 (diff) | |
download | uhd-6d746fd2963a8461cb38efb4189388f96bf1f93e.tar.gz uhd-6d746fd2963a8461cb38efb4189388f96bf1f93e.tar.bz2 uhd-6d746fd2963a8461cb38efb4189388f96bf1f93e.zip |
cmake: Replace distutils with CMake for version checks
This commit replaces the use of distutils.version.LooseVersion() with
CMake's version comparison operator, which implements relational version
string checking in the same manner (i.e., comparing numeric components
of a version string numerically).
Diffstat (limited to 'host/CMakeLists.txt')
-rw-r--r-- | host/CMakeLists.txt | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 0a3bf3d83..3a523ad5d 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -34,6 +34,7 @@ set(MSVC_MIN_VERSION_READABLE "15.0") # all the build-time Python scripts set(PYTHON_MIN_VERSION "3.6") # Other deps +set(SETUPTOOLS_MIN_VERSION "40.0") set(BOOST_MIN_VERSION "1.65") set(NUMPY_MIN_VERSION "1.11") set(RUAMEL.YAML_MIN_VERSION "0.15") @@ -310,33 +311,43 @@ include(UHDLog) ######################################################################## include(UHDPython) -PYTHON_CHECK_MODULE( - "Python version ${PYTHON_MIN_VERSION} or greater" - "platform" "LooseVersion(platform.python_version()) >= LooseVersion('${PYTHON_MIN_VERSION}')" +PYTHON_CHECK_MODULE_VERSION( + "compatible Python version" + "platform" + "platform.python_version()" + ${PYTHON_MIN_VERSION} HAVE_PYTHON_PLAT_MIN_VERSION ) -PYTHON_CHECK_MODULE( - "Mako templates ${PY_MAKO_MIN_VERSION} or greater" - "mako" "LooseVersion(mako.__version__) >= LooseVersion('${PY_MAKO_MIN_VERSION}')" +PYTHON_CHECK_MODULE_VERSION( + "Mako templates module" + "mako" + "mako.__version__" + ${PY_MAKO_MIN_VERSION} HAVE_PYTHON_MODULE_MAKO ) -PYTHON_CHECK_MODULE( - "requests ${PY_REQUESTS_MIN_VERSION} or greater" - "requests" "LooseVersion(requests.__version__) >= LooseVersion('${PY_REQUESTS_MIN_VERSION}')" +PYTHON_CHECK_MODULE_VERSION( + "requests module" + "requests" + "requests.__version__" + ${PY_REQUESTS_MIN_VERSION} HAVE_PYTHON_MODULE_REQUESTS ) -PYTHON_CHECK_MODULE( - "numpy ${NUMPY_MIN_VERSION} or greater" - "numpy" "LooseVersion(numpy.__version__) >= LooseVersion('${NUMPY_MIN_VERSION}')" +PYTHON_CHECK_MODULE_VERSION( + "numpy module" + "numpy" + "numpy.__version__" + ${NUMPY_MIN_VERSION} HAVE_PYTHON_MODULE_NUMPY ) -PYTHON_CHECK_MODULE( - "ruamel.yaml ${RUAMEL.YAML_MIN_VERSION} or greater" - "ruamel.yaml" "LooseVersion(ruamel.yaml.__version__) >= LooseVersion('${RUAMEL.YAML_MIN_VERSION}')" +PYTHON_CHECK_MODULE_VERSION( + "ruamel.yaml module" + "ruamel.yaml" + "ruamel.yaml.__version__" + ${RUAMEL.YAML_MIN_VERSION} HAVE_PYTHON_MODULE_YAML ) |