Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ option(USE_EXTERNAL_LIBS "Use external libraries from AVRDUDE GitHub repositorie
option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF)
option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(ENABLE_PYTHON_SUPPORT "Enable Python support" ON)

if(WIN32)
# Prefer static libraries over DLLs on Windows
Expand Down Expand Up @@ -281,14 +282,16 @@ if(HAVE_LINUXGPIO)
endif()

# -------------------------------------
# Find SWIG
find_package(SWIG 4.0 COMPONENTS python)
if(SWIG_FOUND)
find_package(Python3 COMPONENTS Interpreter Development)
if(PYTHON3_FOUND)
set(HAVE_SWIG 1)
else()
message(STATUS "Found SWIG but no Python3 header/library; cannot use SWIG")
# Find SWIG/Python3 if needed
if(ENABLE_PYTHON_SUPPORT)
find_package(SWIG 4.0 COMPONENTS python)
if(SWIG_FOUND)
find_package(Python3 COMPONENTS Interpreter Development)
if(PYTHON3_FOUND)
set(HAVE_SWIG 1)
else()
message(STATUS "Found SWIG but no Python3 header/library; cannot use SWIG")
endif()
endif()
endif()

Expand Down
Loading