It's 1:12 AM, and I'm tired and frustrated. I'm finally trying to learn cmake, but of course it's overwhelmingly complicated and a problem has show up that only I seemed to be affected with.
The error seems to be about the compiler (Which is g++) being unable to compile a simple test program, and because of that, cmake just won't bother to generate the Makefile.
Here's the CMakeList.txt I was using.
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_MAKE_PROGRAM make)
project(out VERSION 1.0 LANGUAGES CXX)
add_executable(out src/main.cpp)
The command I used
cmake -S . -B build -G "MinGW Makefiles"
And the error message in it's entirety
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/mingw64/bin/g++.exe - broken
CMake Error at C:/mingw64/share/cmake-3.27/Modules/CMakeTestCXXCompiler.cmake:60 (message):
The C++ compiler
"C:/mingw64/bin/g++.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: 'C:/Users/tyler/cpp_programs/learning_cmake/build/CMakeFiles/CMakeScratch/TryCompile-46pogc'
Run Build Command(s): C:/mingw64/bin/cmake.exe -E env VERBOSE=1 "" -f Makefile cmTC_0793c/fast
The parameter is incorrect
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:9 (project)
-- Configuring incomplete, errors occurred!
I can't believe that just making regular Makefiles is more simple than using Cmake. Really makes be wonder why people bothered using it. I'm just very frustrated you know? It feels like I'm working with a black box that always blindsides me with an issue I cannot comprehend.
I just want a solution. I'm using windows 10, I'm using x86_64-w64-mingw32 and NeoVim.