From fa9f2f04391d11d584e9fd5c650fb7d68d1d6272 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sun, 19 Oct 2014 14:36:41 -0400 Subject: [PATCH] Fix MSYS2 build configuration issues. --- CMakeLists.txt | 3 ++- CMakeModules/FindwxWidgets.cmake | 30 +++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a0bedd0bd..05ebb9909d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -617,7 +617,8 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) # Get the correct Python site package install path from the Python interpreter found by # FindPythonInterp unless the user specifically defined a custom path. if( NOT PYTHON_SITE_PACKAGE_PATH ) - execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()" + execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix='')" +# execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE ) diff --git a/CMakeModules/FindwxWidgets.cmake b/CMakeModules/FindwxWidgets.cmake index 99a0236c09..558b70388f 100644 --- a/CMakeModules/FindwxWidgets.cmake +++ b/CMakeModules/FindwxWidgets.cmake @@ -840,6 +840,34 @@ else(wxWidgets_FIND_STYLE STREQUAL "win32") endif(RET EQUAL 0) endif(wxWidgets_CONFIG_EXECUTABLE) + # When using wx-config in MSYS, the include paths are UNIX style paths which may or may + # not work correctly depending on you MSYS/MinGW configuration. CMake expects native + # paths internally. + if(wxWidgets_FOUND AND MSYS) + find_program(_cygpath_exe cygpath ONLY_CMAKE_FIND_ROOT_PATH) + dbg_msg_v("_cygpath_exe: ${_cygpath_exe}") + if(_cygpath_exe) + set(_tmp_path "") + foreach(_path ${wxWidgets_INCLUDE_DIRS}) + execute_process( + COMMAND cygpath -w ${_path} + OUTPUT_VARIABLE _native_path + RESULT_VARIABLE _retv + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if(_retv EQUAL 0) + file(TO_CMAKE_PATH ${_native_path} _native_path) + dbg_msg_v("Path ${_path} converted to ${_native_path}") + set(_tmp_path "${_tmp_path} ${_native_path}") + endif() + endforeach() + dbg_msg("Setting wxWidgets_INCLUDE_DIRS = ${_tmp_path}") + set(wxWidgets_INCLUDE_DIRS ${_tmp_path}) + separate_arguments(wxWidgets_INCLUDE_DIRS) + list(REMOVE_ITEM wxWidgets_INCLUDE_DIRS "") + endif() + endif() #===================================================================== # Neither UNIX_FIND_STYLE, nor WIN32_FIND_STYLE #===================================================================== @@ -900,7 +928,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(wxWidgets FOUND_VAR wxWidgets_FOUND - REQUIRED_VARS wxWidgets_LIBRARIES + REQUIRED_VARS wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS VERSION_VAR wxWidgets_VERSION_STRING )