SWIG is not found in MINGw32/64 MSYS2 Environment by FindSWIG.cmake
OS: Windows 7 Pro 64bit
When i try to generate a makefile with "cmake -G "MSYS Makefiles" -DCMAKE_FIND_ROOT_PATH=c:/msys64" SWIG_DIR is not found:
$ cmake -G "MSYS Makefiles" -DCMAKE_FIND_ROOT_PATH=c:/msys64
CMake Error at C:/msys64/mingw64/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find SWIG (missing: SWIG_DIR)
Call Stack (most recent call first):
C:/msys64/mingw64/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/msys64/mingw64/share/cmake-3.7/Modules/FindSWIG.cmake:63 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:10 (find_package)
-- Configuring incomplete, errors occurred!
The output of "swig -swiglib is correct:
$ swig -swiglib
/usr/share/swig/3.0.10
The problem is that "FindSWIG.cmake" don't allow a CMAKE_FIND_ROOT_PATH (Line 7 in FindSWIG.cmake):
find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH)
After removing "NO_CMAKE_FIND_ROOT_PATH" all work fine:
$ cmake -G "MSYS Makefiles" -DCMAKE_FIND_ROOT_PATH=c:/msys64
-- Found SWIG: C:/msys64/usr/bin/swig.exe (found version "3.0.10")
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/msys64/home/asa/git/GalvoControl/GalvoControl