CMake: Try to use FindPython3.cmake again
Use FindPython3.cmake instead of the deprecated FindPythonInterp.cmake, to make sure we actually find Python3. Don't use the module with MSYS2 because it is buggy and exhibits broken behaviour. Run it earlier in the configuration, just as a precaution, so other indirect calls to find python don't happen earlier.
This commit is contained in:
parent
78efc8d7fa
commit
f653e52e0f
|
@ -81,6 +81,15 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|||
|
||||
message(STATUS "Generating build using CMake ${CMAKE_VERSION}")
|
||||
|
||||
if(USE_MSYSTEM)
|
||||
# Use the deprecated FindPythonInterp.cmake module to Work around bugs and odd behavior in MSYS2 CMake
|
||||
# searching in the wrong paths for python3.exe using FindPython3.cmake
|
||||
find_package(PythonInterp REQUIRED)
|
||||
set(Python3_Executable ${PYTHON_EXECUTABLE})
|
||||
else()
|
||||
find_package(Python3 3.6 REQUIRED)
|
||||
endif()
|
||||
|
||||
# Set a default build type if none was specified
|
||||
set(_default_build_type "RelWithDebInfo")
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
|
@ -406,7 +415,6 @@ set(LOG_RC_VERSION ${LOG_PROJECT_MAJOR_VERSION},${LOG_PROJECT_MINOR_VERSION},${P
|
|||
|
||||
message(STATUS "V: ${PROJECT_VERSION}, MaV: ${PROJECT_MAJOR_VERSION}, MiV: ${PROJECT_MINOR_VERSION}, PL: ${PROJECT_PATCH_VERSION}, EV: ${PROJECT_VERSION_EXTENSION}.")
|
||||
|
||||
find_package(PythonInterp)
|
||||
include(UseLemon)
|
||||
include(UseMakePluginReg)
|
||||
include(UseMakeTaps)
|
||||
|
@ -1776,7 +1784,7 @@ if(VCSVERSION_OVERRIDE)
|
|||
else()
|
||||
add_custom_target(vcs_version
|
||||
BYPRODUCTS vcs_version.h
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/make-version.py
|
||||
${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
@ -3742,7 +3750,7 @@ if(RPMBUILD_EXECUTABLE)
|
|||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/make-version.py
|
||||
${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
@ -4133,7 +4141,7 @@ endif()
|
|||
|
||||
add_custom_target(test
|
||||
COMMAND ${CMAKE_COMMAND} -E env PYTHONIOENCODING=UTF-8
|
||||
${PYTHON_EXECUTABLE} -m pytest
|
||||
${Python3_EXECUTABLE} -m pytest
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
DEPENDS test-programs
|
||||
USES_TERMINAL
|
||||
|
@ -4152,7 +4160,7 @@ if (GIT_EXECUTABLE)
|
|||
# Update AUTHORS file with entries from git shortlog
|
||||
add_custom_target(
|
||||
gen-authors
|
||||
COMMAND ${PYTHON_EXECUTABLE} tools/generate_authors.py AUTHORS
|
||||
COMMAND ${Python3_EXECUTABLE} tools/generate_authors.py AUTHORS
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
else (GIT_EXECUTABLE)
|
||||
|
|
|
@ -127,7 +127,7 @@ if(ASCIIDOCTOR_EXECUTABLE)
|
|||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT
|
||||
${_output_txt}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
|
||||
${_output_html}
|
||||
> ${_output_txt}
|
||||
DEPENDS
|
||||
|
|
|
@ -37,7 +37,7 @@ function(ASN2WRS)
|
|||
# Creates a dissector in the source directory and store the timestamp.
|
||||
add_custom_command(
|
||||
OUTPUT packet-${PROTOCOL_NAME}-stamp
|
||||
COMMAND "${PYTHON_EXECUTABLE}"
|
||||
COMMAND "${Python3_EXECUTABLE}"
|
||||
${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
|
||||
${A2W_FLAGS}
|
||||
${PROTO_OPT}
|
||||
|
@ -47,7 +47,7 @@ function(ASN2WRS)
|
|||
-O "${A2W_OUTPUT_DIR}"
|
||||
${EXT_ASN_FILE_LIST} ${ASN_FILE_LIST} ${EXT_ASN_FILE_LIST_LATE}
|
||||
COMMAND
|
||||
"${PYTHON_EXECUTABLE}" -c
|
||||
"${Python3_EXECUTABLE}" -c
|
||||
"import shutil, sys; x,s,d=sys.argv; open(d, 'w'); shutil.copystat(s, d)"
|
||||
"${A2W_OUTPUT_DIR}/packet-${PROTOCOL_NAME}.c"
|
||||
packet-${PROTOCOL_NAME}-stamp
|
||||
|
@ -66,7 +66,7 @@ function(ASN2WRS)
|
|||
foreach(_asn2wrs_export_file IN LISTS EXPORT_FILES)
|
||||
add_custom_command(
|
||||
OUTPUT ${_asn2wrs_export_file}
|
||||
COMMAND "${PYTHON_EXECUTABLE}"
|
||||
COMMAND "${Python3_EXECUTABLE}"
|
||||
${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
|
||||
-E
|
||||
${A2W_FLAGS}
|
||||
|
|
|
@ -4,7 +4,7 @@ function(register_plugin_files _outputfile _registertype)
|
|||
add_custom_command(
|
||||
OUTPUT
|
||||
${_outputfile}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/make-plugin-reg.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${_registertype}
|
||||
|
|
|
@ -5,7 +5,7 @@ MACRO(REGISTER_TAP_FILES _outputfile)
|
|||
OUTPUT
|
||||
${_outputfile}
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py taps ${_outputfile} ${_sources}
|
||||
${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py taps ${_outputfile} ${_sources}
|
||||
DEPENDS
|
||||
${CMAKE_SOURCE_DIR}/tools/make-regs.py
|
||||
${_sources}
|
||||
|
|
|
@ -310,7 +310,7 @@ ADD_CUSTOM_COMMAND(
|
|||
OUTPUT
|
||||
wsluarm
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory wsluarm_src
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/make-wsluarm.py
|
||||
--output-directory wsluarm_src
|
||||
${WSLUA_MODULES}
|
||||
|
|
|
@ -29,7 +29,7 @@ endif()
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ps.c
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/rdps.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/print.ps
|
||||
ps.c
|
||||
|
|
|
@ -15,7 +15,7 @@ add_subdirectory(pidl EXCLUDE_FROM_ALL)
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/packet-ncp2222.c
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/ncp2222.py
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/packet-ncp2222.c
|
||||
DEPENDS
|
||||
|
@ -2144,7 +2144,7 @@ file(GENERATE
|
|||
)
|
||||
add_custom_command(
|
||||
OUTPUT dissectors.c
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py dissectors dissectors.c @dissectors.in.txt
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py dissectors dissectors.c @dissectors.in.txt
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/tools/make-regs.py ${ALL_DISSECTOR_SRC}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/dissectors.in.txt"
|
||||
COMMENT "Making dissectors.c"
|
||||
|
|
|
@ -74,7 +74,7 @@ add_custom_command(
|
|||
# XXX taps.txt doesn't appear to be used anywhere.
|
||||
${CMAKE_BINARY_DIR}/epan/wslua/taps.txt
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE}
|
||||
${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/epan/wslua/make-taps.py
|
||||
${CMAKE_BINARY_DIR}/epan/wslua/taps_wslua.c
|
||||
${CMAKE_BINARY_DIR}/epan/wslua/taps.txt
|
||||
|
@ -91,7 +91,7 @@ add_custom_command(
|
|||
declare_wslua.h
|
||||
register_wslua.c
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE}
|
||||
${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/epan/wslua/make-reg.py
|
||||
${WSLUA_MODULES}
|
||||
DEPENDS
|
||||
|
|
|
@ -296,7 +296,7 @@ macro( ADD_NSIS_PACKAGE_TARGETS )
|
|||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${_nsis_binary_dir}/wireshark-qt-manifest.nsh
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${_nsis_source_dir}/windeployqt-to-nsis.py"
|
||||
COMMAND ${Python3_EXECUTABLE} "${_nsis_source_dir}/windeployqt-to-nsis.py"
|
||||
$<TARGET_FILE:wireshark>
|
||||
${_nsis_binary_dir}/wireshark-qt-manifest.nsh
|
||||
#$<$<CONFIG:Debug>:-DebugConfig>
|
||||
|
|
|
@ -669,7 +669,7 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/authors.qrc"
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/authors.csv
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-authors-csv.py
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-authors-csv.py
|
||||
< ${CMAKE_SOURCE_DIR}/AUTHORS
|
||||
> ${CMAKE_CURRENT_BINARY_DIR}/authors.csv
|
||||
DEPENDS
|
||||
|
|
|
@ -151,7 +151,7 @@ file(GENERATE
|
|||
)
|
||||
add_custom_command(
|
||||
OUTPUT wtap_modules.c
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py wtap_modules wtap_modules.c @wtap_modules.in.txt
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py wtap_modules wtap_modules.c @wtap_modules.in.txt
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/tools/make-regs.py ${WIRETAP_MODULE_FILES}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/wtap_modules.in.txt"
|
||||
COMMENT "Making wtap_modules.c"
|
||||
|
|
Loading…
Reference in New Issue