diff --git a/CMakeLists.txt b/CMakeLists.txt index 21a0ef1b15..921cc0bbc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -666,6 +666,13 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) # wxWidgets found. At least the major an minor version should match. set( _wxpy_version "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}" ) set( _py_cmd "import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" ) + + # Add user specified Python site package path. + if( PYTHON_SITE_PACKAGE_PATH ) + set( _py_cmd + "import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");${_py_cmd}" ) + endif() + execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}" RESULT_VARIABLE WXPYTHON_VERSION_RESULT OUTPUT_VARIABLE WXPYTHON_VERSION_FOUND @@ -681,11 +688,12 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) endif() if( NOT WXPYTHON_VERSION_FOUND STREQUAL "True" ) - message( FATAL_ERROR "wxPython version ${_wxpy_version} does not appear to be installed on the system." ) - else() - set( WXPYTHON_VERSION_FOUND "${_wxpy_version}" - CACHE STRING "wxPython version found." ) + message( FATAL_ERROR + "wxPython version ${_wxpy_version} does not appear to be installed on the system." ) endif() + + set( WXPYTHON_VERSION ${_wxpy_version} CACHE STRING "wxPython version found." ) + message( STATUS "wxPython version ${_wxpy_version} found." ) endif() #message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" ) @@ -825,6 +833,9 @@ else() message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" ) endif() +# Generate config.h. +configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake + ${CMAKE_BINARY_DIR}/config.h ) #================================================ # "make uninstall" rules diff --git a/CMakeModules/PerformFeatureChecks.cmake b/CMakeModules/PerformFeatureChecks.cmake index 5c9d092957..b48cb0af60 100644 --- a/CMakeModules/PerformFeatureChecks.cmake +++ b/CMakeModules/PerformFeatureChecks.cmake @@ -109,9 +109,4 @@ macro( perform_feature_checks ) # getc() on platforms where getc_unlocked() doesn't exist. check_symbol_exists( getc_unlocked "stdio.h" HAVE_FGETC_NOLOCK ) - # Generate config.h. - configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake - ${CMAKE_BINARY_DIR}/config.h - ) - endmacro( perform_feature_checks ) diff --git a/CMakeModules/config.h.cmake b/CMakeModules/config.h.cmake index 46272e82c0..a71d1661d3 100644 --- a/CMakeModules/config.h.cmake +++ b/CMakeModules/config.h.cmake @@ -72,7 +72,7 @@ /// The wxPython version found during configuration. #if defined( KICAD_SCRIPTING_WXPYTHON ) -#define WXPYTHON_VERSION "@WXPYTHON_VERSION_FOUND@" +#define WXPYTHON_VERSION "@WXPYTHON_VERSION@" #endif /// When defined, build the GITHUB_PLUGIN for pcbnew.