-2

my CMake file contains an error at this line:

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):Could not find compiler set in environment variable CXX:

C:\MinGW\bin.

Where can I define a correct path for this?

enter image description here

Here ist the CMakeLists.txt:

# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(generic_gpio)

and the other CMakelists.txt

idf_component_register(SRCS "gpio_example_main.c"
                    INCLUDE_DIRS ".")
jento
  • 47
  • 3
  • Looks like you've set `CXX` to `C:\MinGW\bin`, it needs to be the full path to the compiler executable, not a directory – Alan Birtles Jun 21 '23 at 06:04
  • Please, [don't post your code/error messages as images](https://meta.stackoverflow.com/a/285557/4298200). Firstly we want to copy/paste it and secondly search engines are unable to index that information. So please make sure that any textual information is actually provided in text form. – 273K Jun 21 '23 at 06:24
  • Consider using [MSYS2](https://stackoverflow.com/q/30069830/2752075) to install both MinGW and CMake. There everything works out of the box, without manually configuring compiler paths and what not. – HolyBlackCat Jun 21 '23 at 07:16

1 Answers1

0

I think you should to show us your CMakeLists.txt. Also, CMake must to find available compiler manually. If your MinGW compiler is added to PATH variable in Windows then CMake will detect it.

If you want to use SPECIAL COMPILEr which is needed to build your source code then you need to specify this like that:

1-st way:

set(CMAKE_CXX_COMPILER "C://MinGW/bin/g++.exe")

2-nd way:

You can start cmake configuration with special flags like here:

cmake -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ path/to/directory/which/contains/CMakeLists.txt
Allen
  • 1
  • 1