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)
Related
I am compiling a rather big C++ project with cmake.
The project has several targets defined in the CMakeLists.txt of the various subdirectories
I can create a folder somewhere and use cmake to prepare compilation of the targets, and compile any of the target :
cmake ..
make -j8 cytosim
And this works.
However, if I call cmake with a target :
cmake .. --target cytosim
I get the error
CMake Error: The source directory ".../build/cytosim" does not exist.
I thought target was supposed to be a module/library/executable target... What am I missing ?
CMake --target argument is usable in CMake Build Mode (--build).
Try cmake --build .. --target cytosim
I need to build my CMake based project under MSVC 2013 and MSVC 2019.
With MSVC 2019 using Ninja generator I build it successfully with following commands:
cmake -S . -B build -GNinja "-DCMAKE_BUILD_TYPE:STRING=Release"
cmake --build build --target all
On MSVC 2013 I have no Ninja available, so I tried the following:
cmake -S . -B build -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build --target all
Anyway I am getting following error and nothing is built:
MSBUILD : error MSB1009: Project file does not exist.
Switch: all.vcxproj
Any idea how to build it without ninja? (I cannot install it, since I am building it on a build server.)
In contrast to other generators (like Makefiles or Ninja) CMake does not generate an all target for Visual Studio solution but an ALL_BUILD target.
So cmake --build build --target ALL_BUILD --config Release should succeed.
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
I am trying to build the C++ library for Apache Thrift and I am getting a cmake error that I cannot quite decipher, this is the series of steps I followed to get the error
git clone https://git-wip-us.apache.org/repos/asf/thrift.git
cd thrift/lib/cpp
mkdir cmake-build
cmake ..
And the error I get is
CMake Error at CMakeLists.txt:162 (include):
include could not find load file:
ThriftMacros
CMake Error at CMakeLists.txt:164 (ADD_LIBRARY_THRIFT):
Unknown CMake command "ADD_LIBRARY_THRIFT".
Has someone else encountered this error before as well?
This isn't the way to build it. You need to build from the root directory as instructed otherwise, you will miss a whole slew of CMake definitions.
From the root repository directory:
mkdir cmake-build && cd cmake-build
cmake .. -DBUILD_CPP:BOOL=ON
I run cmake in command prompt with:
mkdir build && cd build
.. cmake
But now, I have problem constructing the command to build realease static.
I tried:
C:\Users\Kuba\Downloads\rabbitmq-c>cmake --build build --BUILD_STATIC_LIBS=ON
Which yields the error:
Unknown argument --BUILD_STATIC_LIBS=ON
How to correct this? Thanks !
You should define the variable using the -D option:
cmake --build build -DBUILD_STATIC_LIBS=ON
Please read the documentation for more information.
Configuring the build is a separate step from building it.
From the source directory create a binary directory:
mkdir build && cd build
Then configure the build (this is where you can add other build-flags):
cmake -DBUILD_STATIC_LIBS=ON ..
then build it:
cmake --build .