Where to install mingw-make from? (CMAKE) - c++

I've been trying to compile my code with CMake using the "MSYS Makefiles" generator. I wrote the following command:
cmake -S . -B build/ -G "MSYS Makefiles
But I was presented with the following error:
CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_AR was not found, please set to archive program.
After some investigation, I found that I had to install something called "mingw-make" to do this. Apparently this "mingw-make" can be installed in the "MinGW gui". Note that I checked if I already have "mingw-make" installed and I don't.
I'm confused because I can't seem to find this "MinGW gui" anywhere. I installed MinGW, and only have an application on my computer called "Modify or Remove MinGW". I searched the install options, and couldn't find "mingw-make" anywhere.
Where can I download this "mingw-make" from? Thanks.

Use mingw32-make only with cmake -G"MinGW Makefiles".
Use make only with cmake -G"MSYS Makefiles".
But if you want the best performance you should get Ninja and use ninja with cmake -G"Ninja".
MinGW is all command line, though there are some GUI installers for it. MinGW-w64 is the successor to MinGW which also supports 64-bit Windows.
There are standalone MinGW-w64 Windows releases available from https://winlibs.com/ that don't require installation steps, just extract. This also includes mingw32-make

Related

what is the correct way to use cmake

I was following instructions for compiling a software in windows as described here: https://github.com/solvespace/solvespace . But when i launch the first cmake command it points out the following :
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake -DCMAKE_BUILD_TYPE=Release
CMake Error at CMakeLists.txt:42 (project):
Running
'nmake' '-?'
failed with:
Impossibile trovare il file specificato
-- Configuring incomplete, errors occurred!
See also "C:/Users/user/Documents/experiments/SolveSpaceFolder/solvespace/build/CMakeFiles/CMakeOutput.log".
i've alredy installed mingw64 and added to PATH, in fact it work alone. Moreover I can see that there is nmake implied. I just can't figure out what's the problem.
Remove CMakeCache.txt and try to set the generator
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles"
Related question: CMake & MinGW Compilation on Windows, without needing the -G "MinGW Makefiles" flag.

How do I stop cmake from compiling with cl?

I am trying to build a c++ project using cmake. I am using sublime text on windows. Here is my CMakeLists.txt configuration:
project(Arena)
cmake_minimum_required(VERSION 3.0)
set(CMAKE_C_COMPILER C:\MinGW\bin)
set(CMAKE_CXX_COMPILER C:\MinGW\bin)
When I run the cmake . command, I get the following error messages:
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (project):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:1 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
The error message says that the cl compiler is not found, this is because I have not installed it. But I have installed the MINGW GNU compiler collection (GCC). These are in my PATH at C:\MinGW\bin. How do I configure cmake to compile using the compilers I already have on my machine?
Stupid Question Alert: I am also confused as to why the error message is talking about an NMake generator with Visual C++ because I am not using Visual Studio?
Attempt 1:
Ran the cmake command like so cmake . -G "MinGW Makefiles", got the following error:
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
I am also confused as to why the error message is talking about an NMake generator with Visual C++ because I am not using Visual Studio?
It seems that your CMake decided that "NMake Makefiles" was the default generator type, which means the CMake configuration step was outputting project/makefiles for NMake.
How do I configure cmake to compile using the compilers I already have on my machine?
When you run CMake, specify the generator:
cmake . -G "MinGW Makefiles"
There are also some things you should do to improve/fix your CMakeLists.txt:
Specify the minimum version before the project line.
Add the following lines to tell CMake where your MinGW binaries are:
set(CMAKE_MAKE_PROGRAM <your make program path>)
set(CMAKE_C_COMPILER <your c compiler path>)
set(CMAKE_CXX_COMPILER <your c++ compiler path>)
This step should be unecessary if MinGW is properly added to your PATH.
Specify the languages used by the project.
project(Arena LANGUAGES CXX)
You need to designate your compiler in the CMakeList.txt file:
set(CMAKE_C_COMPILER <your c path >)
set(CMAKE_CXX_COMPILER <your c++ path here>)

make: *** No targets specified and no makefile found. Stop. [ubuntu]

I'm trying to build this
https://github.com/patrikhuber/eos
but I'm having troubles.
The instructions are pretty simple, as it says on gitHub
To build:
git clone --recursive https://github.com/patrikhuber/eos.git
mkdir build && cd build # creates a build directory next to the 'eos' folder
cmake -G "<your favourite generator>" ../eos -DCMAKE_INSTALL_PREFIX=../install/
make && make install # or open the project file and build in an IDE like Visual Studio
I'm using "Ninja" as generator and it looks like the cmake part goes through successfully as I get
-- Configuring done
-- Generating done
-- Build files have been written to: /home/francesco/eos/build
That's where things stop "working" for me, or where I fail to understand what's next. Following the instructions, I type
make && make install
and I get this message
make: *** No targets specified and no makefile found. Stop.
I looked around for solutions but I don't really understand what I am supposed to do: I tried
./configure
but I'm getting
bash: ./configure: No such file or directory
Anyone can please help?
Thanks
It always depends on your CMake "Generator". The 'make' is linux/mingw tool/command. For VisualStudio you can use nmake or sln/proj generated stuff.
More reliable could be utilize CMake for building i.e. for "NMake Makefiles" generator:
cmake --build <build folder> --target install
or
cmake --build <build folder> --config release --target install
for VisualStudio generator
I had the same problem, and solved by tinkering with locations for cmake and make. Here's what I used:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make
I believe /usr/local is the default location (see here)

What MinGw packages do I need to install to use CLion?

I am using CLion to write C++ programs and I am using MinGW.But I have some files missing namely-Make,C Compiler and C++ Compiler which are not found.I am using MinGW Installation Manager to install the packages but I don't know the exact names of the packages I have to install.
What are the names of the packages I need to install to get rid of this error?(I need the specific names that I can get in the MinGW Installation manager.)
I am also getting these error messages-
"C:\Program Files\JetBrains\CLion 2017.1.2\bin\cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles"
C:\Users\Lenovo\CLionProjects\untitled
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Thanks for any help!!
tps://i.stack.imgur.com/SFWFU.png
Under the "Basic Setup" category in the installer, you need to select and install mingw32-gcc-g++ and mingw32-make.

how to use make and make install in mac

I have a question related to cmake and make in Windows. As we already knows that in windows we can use
cmake -G"Visual Studio 12" ..
cmake --build . --target INSTALL --config Release
to compile and install the target using command lines. In linux, we can use
cmake -DCMAKE_BUILD_TYPE=Release ..
make
make install
to do the same job. Then how about mac? In mac, I tried to use:
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 ../ -G Xcode
make
make install
but failed. Any ideas? Thanks.
You can use cmake --build on any platform as it
abstracts a native build tool's command-line interface