@@ -62,14 +62,8 @@ else (NOT APPLE)
6262 set (rt "" )
6363endif (NOT APPLE )
6464
65- # This setting mirrors FindPythonInterp behavior on Windows/macOS, which did not consult registry/frameworks first.
66- if (NOT DEFINED Python_FIND_REGISTRY)
67- set (Python_FIND_REGISTRY "LAST" )
68- endif ()
69- if (NOT DEFINED Python_FIND_FRAMEWORK)
70- set (Python_FIND_FRAMEWORK "LAST" )
71- endif ()
72- find_package (Python REQUIRED COMPONENTS Interpreter Development )
65+ find_package (PythonInterp REQUIRED )
66+ find_package (PythonLibs REQUIRED )
7367find_package (Threads REQUIRED )
7468find_package (Proton 0.33.0 REQUIRED COMPONENTS Core Proactor )
7569message (STATUS "Found Proton: ${Proton_LIBRARIES} (found version \" ${Proton_VERSION} \" )" )
@@ -108,29 +102,31 @@ if (LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING)
108102endif (LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING )
109103
110104# Python
111- if (Python_VERSION_MAJOR STREQUAL 3)
105+ if (PYTHON_VERSION_MAJOR STREQUAL 3)
112106 set (PY_STRING "python3" )
113- elseif (Python_VERSION_MAJOR STREQUAL 2)
107+ elseif (PYTHON_VERSION_MAJOR STREQUAL 2)
114108 set (PY_STRING "python" )
115109endif ()
116110
111+ enable_testing ()
112+
117113# python unittest
118114# For versions < 2.7 the developer needs to install the unittest2
119115# module (available via 'yum install python-unittest2' or 'pip install unittest2'
120116#
121- if (Python_VERSION_MAJOR EQUAL 2 AND Python_VERSION_MINOR LESS 7)
117+ if (PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR LESS 7)
122118 set (PYTHON_TEST_COMMAND "unit2" )
123- execute_process (COMMAND "${Python_EXECUTABLE } " "-c" "import unittest2"
119+ execute_process (COMMAND "${PYTHON_EXECUTABLE } " "-c" "import unittest2"
124120 RESULT_VARIABLE UNITTEST_MISSING
125121 ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE )
126122 if (UNITTEST_MISSING)
127123 message (WARNING "python-unittest2 is not installed. ***unit tests cannot be run***\n try 'pip install python-unittest2' to install python-unittest2" )
128124 # add bogus test for folk who may have missed the cmake warning
129125 add_test (WARNING_python_unittest2_module_NOT_INSTALLED false )
130126 endif (UNITTEST_MISSING )
131- else (Python_VERSION_MAJOR EQUAL 2 AND Python_VERSION_MINOR LESS 7 )
127+ else (PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR LESS 7 )
132128 set (PYTHON_TEST_COMMAND "-m" "unittest" )
133- endif (Python_VERSION_MAJOR EQUAL 2 AND Python_VERSION_MINOR LESS 7 )
129+ endif (PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR LESS 7 )
134130
135131if (NOT UNITTEST_MISSING)
136132 if (NOT DEFINED DISPATCH_TEST_TIMEOUT)
@@ -166,7 +162,7 @@ set(CONSOLE_BASE_INSTALL_DIR "share/qpid-dispatch/console")
166162set (CONSOLE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX } /${CONSOLE_BASE_INSTALL_DIR} " )
167163set (CONSOLE_STAND_ALONE_INSTALL_DIR "${CONSOLE_INSTALL_DIR} " )
168164
169- set (RUN ${Python_EXECUTABLE } ${CMAKE_BINARY_DIR } /run.py)
165+ set (RUN ${PYTHON_EXECUTABLE } ${CMAKE_BINARY_DIR } /run.py)
170166
171167# define the configuration directory based on whether or not the install prefix is defined
172168if (NOT DEFINED SYSCONF_INSTALL_DIR)
@@ -197,7 +193,7 @@ include_directories(
197193 ${CMAKE_CURRENT_BINARY_DIR } /include
198194 ${Proton_Proactor_INCLUDE_DIRS}
199195 ${Proton_Core_INCLUDE_DIRS}
200- ${Python_INCLUDE_DIRS }
196+ ${PYTHON_INCLUDE_PATH }
201197 )
202198
203199# Originally from the LLVM project, https://opensource.apple.com/source/llvmCore/llvmCore-2358.3/CMakeLists.txt.auto.html
0 commit comments