Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake with git for windows, MinGW and make

Tags:

mingw

cmake

Firstly, I have installed MinGW from https://sourceforge.net/projects/mingw/files/ and the mingw32-gcc-g++ and mingw32-gcc-objs with it. I have added C:\MinGW\bin to my path.

Secondly, I have installed Git for windows (not really important, the result is the same on cmd.exe).

Thirdly, I have installed the complete package "make" with http://gnuwin32.sourceforge.net/packages/make.htm

After that, I have installed cmake 3.5.1 with the .msi.

But when I run cmake ../src the result is :

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (project):
No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:5 (project):
  No CMAKE_CXX_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "C:/Users/pauka/Dropbox/ETUDE/SRI/S8/STA_Stage/sources/tests/bin/CMakeFiles/CMakeOutput.log".
See also "C:/Users/pauka/Dropbox/ETUDE/SRI/S8/STA_Stage/sources/tests/bin/CMakeFiles/CMakeError.log".

So cmake can't find gcc or g++. But when I run gcc -version, the output is good... What should I configure for cmake ?

My CMakeLists.txt is :

# Ajustez en fonction de votre version de CMake
cmake_minimum_required (VERSION 2.8)

# Nom du projet
project (main)

find_package (OpenCV REQUIRED)

# Exécutable "main", compilé à partir du fichier main.cpp
add_executable (tracking_color tracking_color.cpp)
add_executable (feuille feuille.cpp)
add_executable (detect_circles detect_circles.cpp)
add_executable (segmentation segmentation.cpp)
add_executable (watershed_perso watershed_perso.cpp)
add_executable (main main.cpp utils.h)
add_executable (info_coins info_coins.cpp)

# main sera linké avec les bibliothèques d'OpenCV
target_link_libraries (tracking_color ${OpenCV_LIBS})
target_link_libraries (feuille ${OpenCV_LIBS})
target_link_libraries (detect_circles ${OpenCV_LIBS})
target_link_libraries (segmentation ${OpenCV_LIBS})
target_link_libraries (watershed_perso ${OpenCV_LIBS})
target_link_libraries (info_coins ${OpenCV_LIBS})
target_link_libraries (main ${OpenCV_LIBS})
like image 555
onda47 Avatar asked Oct 31 '22 05:10

onda47


1 Answers

Ok, shame on me,

I had to restart my computer and select "MinGW Makefiles" in the CMake GUI. Click configure, and after that "Generate".

Next, you must not use "Git for windows" because there is "sh.exe" and it's a cmake bug.

PS: to use OpenCV, you must compile it :

cd C:\opencv
mkdir my_build
cd my_build
cmake -G "MinGW Makefiles" ../sources
mingw32-make # took 2 hours on my computer

and next add, C:\opencv\my_build and C:\opencv\my_build\bin to the system path.

like image 160
onda47 Avatar answered Nov 13 '22 04:11

onda47