CMake does not create make file [duplicate] - c++

This question already has an answer here:
Why isn't the command "cmake ." generating a makefile? [closed]
(1 answer)
Closed 3 years ago.
I am using cmake to build the project. I am new to c++ so there can be mistakes as i am unaware of how it internally works.
When i run cmake command in build directory then the response does not give any error. The output is as shown in next image.image after cmake command
Now when i go to the test directory then i see these files.
image of test directory
As i already said i don't know how it internally works but following some online tutorials i expect that there should be a make file but i'm not getting that.
Any help would be great for as i am stucked in this setup from 3 days.
This is what is want to do next:
First, standard build files should be created from
these configuration files:
cd test/ && mkdir build && cd build,
cmake ..
Note that you have to run these commands only once. Next, you can use your platform’s native build tools
for the actual building:
make -j10
And train a single decision tree or bagging classifier with:
./DecisionTreeTest, and
./BaggingTest,

If you have Visual Studio 2019 you will want to run your cmake (from the build directory) as
cmake -G "Visual Studio 16 2019" ..
and you will get a new configuration and .sln generated in your build folder.
From there you can open the .sln in visual studio, or run (in your build directory)
cmake --build .
to begin compilation of a debug build or
cmake --build . --config Release
for a release build.

Related

cmake build directory, Windows VS macOS

Typical cmake produre here was:
cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg.cmake
cmake --build .
That worked on both Windows and macOS.
Howver on Windows the binary in placed under build/Debug/mylib.dll while on macOS it is placed directly under build/libmylib.dylib. How can I make it on build/Debug/libmylib.dylib on macOS too?
You could simply manually reproduce the same directory structure yourself on the Mac.
However, I would definitely make sure to only put a Debug configuration in a directory called Debug, lest you confuse yourself in the future:
mkdir Debug
cd Debug
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg.cmake
cmake --build .

Building .SLN files on Windows without Visual Studio?

I have recently been trying to set up my CMake environment and some 'hello world' code in C++. I added a CMakeLists.txt and added my configurations, but when I ran cmake . in the command line, something was different from all of the tutorials.
The people on the tutorials were using a Unix based system, so the command cmake . was producing a 'makefile'. They then built the makefile using the command make.
Since I'm on windows, it generated a msvc .sln file instead of a makefile. My question is - how can I build the .sln file, similar to how they did it on Linux? I want to do it without Visual Studio 2019 and preferably in the command prompt.
I have tried searching for this question, but haven't found what I'm looking for. Thank you in advance.
First of all, you should never do an in-tree build with cmake .. It invites problems in the form of name clashes and makes it nearly impossible to get a clean rebuild.
If you're using a recent version of CMake (which you should be), the standard way to build a project varies on whether the backend generator is single-config or multi-config.
If it's single-config (like Make or Ninja), then the commands are:
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S /path/to/sources -B /path/to/build
$ cmake --build /path/to/build
The directory /path/to/build doesn't need to exist when you invoke CMake. If you wanted a Debug build, rather than Release, you would just replace that in the first line. You should never run a single-config generator without setting CMAKE_BUILD_TYPE.
If it's multi-config, like Visual Studio, then the commands are:
$ cmake -G "Visual Studio 16 2019" -A x64 -Thost=x64 -S /path/to/sources -B /path/to/build
$ cmake --build /path/to/build --config Release
The major difference here is that the config is specified in the second (build) command, rather than the first (configure).

how to compile Libsmscout Library on Windows?

While I try to Run CMake for the Library https://github.com/Framstag/libosmscout
I get an Error on CMake Line 250
create_private_config("${CMAKE_CURRENT_BINARY_DIR}/privateinclude/osmscout/private/Config.h" "OSMScout")
error: Unknown CMake command "create_private_config .
OS: Windows 10 ; IDE: Qt Creator
From browsing the repository, it appears the error is occurring in the libosmscout/libosmscout/CMakeLists.txt file at line 250. CMake defines this function in libosmscout/cmake/features.cmake, a file which is included from the top-level CMake file. Try running CMake using the commands below, ensuring CMake starts from the root directory of the repository (same directory containing the appveyor.yml file):
cd C:/path/to/your/repo_root
mkdir build
cd build
cmake ..
The appveyor.yml file has some example configurations (e.g. Visual Studio 2015, x64) that have been tested with this project.

using CMake to build Google Test

I am trying to use CMake to build Google Test.
As mentioned in the README of Google Test,
I have issued following commands:
mkdir mybuild # Create a directory to hold the build output.
cd mybuild
cmake D:\gtest-1.6.0 # (in the README this was set as:cmake ${GTEST_DIR}, but since on my machine D:\gtest-1.6.0 is where I have downloaded gtest, I have used that in command prompt.
And here is the error I get:
Any help? any help would be greatly appreciated as I am stuck with it and can't move forward...... Thanks.
ps. I have Visual Studio 10 installed on my machine.
If you use Visual c++ compiler with cmake you must launch it from the Visual c++ command prompt. Otherwise cmake will not found your compiler.

Code::blocks cmake makefile nothing to be done when building

I've downloaded PhysFS and attempted to build it with Cmake. The option I
generated with is Code::Blocks makefiles, which generated a project file.
I supposed it was as easy as opening that project file and trying to build but
that didn't happen.
Upon building the project I get
-------------- Build: all in PhysicsFS ---------------
Using makefile: Makefile
Execution of 'make.exe -s -f Makefile all' in
'C:\Documents and Settings\Stefan.MONA-H6H4KPUJNF\Desktop\build' failed.
Nothing to be done.
I've tried checking out a similar question, but the options in the answer
were already good, and it didn't work.
I'm on windows XP SP3