CMake command displays error at "CMakeLists.txt" with FindCEF - c++

I have a problem when executing the following command:
cmake -G "Visual Studio 15 2017 Win64" ..
The error:
CMake Error at CMakeLists.txt:155 (find_package):
By not providing "FindCEF.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "CEF", but
CMake did not find one.
Could not find a package configuration file provided by "CEF" with any of
the following names:
CEFConfig.cmake
cef-config.cmake
Add the installation prefix of "CEF" to CMAKE_PREFIX_PATH or set "CEF_DIR"
to a directory containing one of the above files. If "CEF" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!

Related

How to I install libuv and subsequently uWebSockets library on Windows 10?

I am trying to install few libraries that are required for cmake to build a project.
For successful build, cmake requires libuv and uWebSockets libraries to be installed:
https://github.com/uNetworking/uWebSockets
I'm using MinGW gcc compiler (C:\msys64\mingw64) along with cmake.
However, during configuration cmake fails with the following errors:
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at examples/example1/CMakeLists.txt:14 (find_library):
[cmake] Could not find UV_LIB using the following names: uv
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
Now, I have downloaded the tar-balls from the above GitHub repo, but I am unable to understand where and how this is to be installed.

CMake Error Failed to run MSBuild command

I am very new to CMake and try to build a minimum CMake file on Windows where I have installed Visual Studio 17 and 19. The C++ code is the bare minimum main.cpp:
#include<iostream>
int main()
{
std::cout << "Hello" << std::endl;
return 0;
}
The CMakeLists.txt file is also the minimum:
cmake_minimum_required(VERSION 3.1)
project(hello)
add_executable(${PROJECT_NAME} main.cpp)
When I run the CMake on the command line, I get this error and I do not know how to resolve it:
C:\SampleProject\build>cmake ./../src
-- Building for: Visual Studio 15 2017
CMake Error at CMakeLists.txt:3 (project):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
The system cannot find the file specified
By default VC++ tools aren't on the PATH, they are added to the PATH by the vcvarsall.bat script.
Run cmake from a "x64 Native Tools Command Prompt for VS 2019" (it's a shortcut to vcvarsall.bat that Visual Studio installs in the Start Menu).
Bonus note:
When not using Visual Studio integration, you might want to consider Ninja as the alternative build system to MSBuild. It's more CMake-friendly because it doesn't require the Debug/Release duality of configuration (which is the source of headache when working with CMake).
Download ninja.exe, add it to the PATH
Use the Ninja CMake generator: cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
Enjoy easy and fast builds using the ninja command.
To build a Release version, re-run cmake with -DCMAKE_BUILD_TYPE=Release (so this works very much the same as on other platforms, e.g. Linux).
Ninja also integrates well with the VSCode CMake extension (note: VSCode != VS).

Could not find a package configuration file provided by "io2d" (Windows)

I am newbie in using C++ and I have hard times to compile the io2d with CMake. I am currently using Windows, and I have used vcpkg to download the io2d packages, cairo packages and graphicsmagick packages. Everything are downloaded by both x64 and x86 windows.
The way I follow through on the installation work is from the Buildings Steps in Cairo/Win32 on Windows:
https://github.com/cpp-io2d/P0267_RefImpl/blob/master/BUILDING.md
However, when I build with cmake -G "Visual Studio 16 2019" --config Debug "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_TOOLCHAIN_FILE=c:/source/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows" ..\. , it appears the following error. And I have looked for online but seems cannot find a solution with windows system.
Happy to get any opinions and help on this issue.
PS C:\Users\samue\OneDrive\桌面\Udacity\CppND-Route-Planning-Project\P0267_RefImpl\Debug> cmake -G "Visual Studio 16 2019" --config Debug "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_TOOLCHAIN_FILE=c:/source/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows" ..\.
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
Default IO2D backend was not specified, choosing automatically...
Found Windows, using CAIRO_WIN32.
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find Cairo (missing: CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE)
cmake/FindCairo.cmake:102 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
P0267_RefImpl/P0267_RefImpl/cairo/CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
I have tried another way to compile, but also does not work which yield to another problem. The location of my entire project folder is in the following address: C:\Users\samue\OneDrive\桌面\Udacity\CppND-Route-Planning-Project.
When I tried to build the project, firstly I cd to the address above.
Then use mkdir build and cd build
Then run cmake ..
But, it appears the error code in finding the io2d configuration files. I have no idea how to let CMake to find the required files. The error is located as belows:
PS C:\Users\samue\OneDrive\桌面\Udacity\CppND-Route-Planning-Project\build> cmake ..
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
CMake Error at C:/source/vcpkg/scripts/buildsystems/vcpkg.cmake:622 (_find_package):
By not providing "Findio2d.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "io2d", but
CMake did not find one.
Could not find a package configuration file provided by "io2d" with any of
the following names:
io2dConfig.cmake
io2d-config.cmake
Add the installation prefix of "io2d" to CMAKE_PREFIX_PATH or set
"io2d_DIR" to a directory containing one of the above files. If "io2d"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:15 (find_package)
-- Configuring incomplete, errors occurred!

Building GRPC keeps failing on windows

I am trying build grpc CPP from the source using CMake as described in github for Windows but it is keep on failing with following error:
E:\gok\IEC61850\grpc\New folder\grpc>md .build
E:\gok\IEC61850\grpc\New folder\grpc>cd .build
E:\gok\IEC61850\grpc\New folder\grpc\.build>cmake .. -G "Visual Studio 14 2015"
CMake Error at CMakeLists.txt:31 (project):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
The system cannot find the file specified
-- Configuring incomplete, errors occurred!
See also "E:/gok/IEC61850/grpc/New folder/grpc/.build/CMakeFiles/CMakeOutput.log

CMake (win) mysql c++ connector - cant find mysql

i'm trying to build the c++ connector for VS 2012 with CMake.
It's searching for the MySQL Directory but it can't find it.
C:\mysql-connector-c++-1.1.3>cmake -DBOOST_ROOT:STRING=C:\cpp\boost
CMake Warning (dev) in CMakeLists.txt:
A logical block opening on the line
C:/mysql-connector-c++-1.1.3/CMakeLists.txt:39 (if)
closes on the line
C:/mysql-connector-c++-1.1.3/CMakeLists.txt:41 (endif)
with mis-matching arguments.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Environment compile flags:
-- Environment link flags:
-- Boost version: 1.53.0
-- BOOST_INCLUDE_DIRS=C:/cpp/boost
-- ENV{MYSQL_DIR} =
**CMake Error at FindMySQL.cm:220 (MESSAGE):
Cannot find MySQL. Include dir: MYSQL_INCLUDE_DIR-NOTFOUND library dir:**
cxxflags:
Call Stack (most recent call first):
CMakeLists.txt:173 (INCLUDE)
-- Configuring incomplete, errors occurred!
Is there a way to set it manual by hand?
Thank you.
Of course: if you know where your MySql include directories are located (say C:\MySql\include for example), just call CMake with the following -D option:
cmake -DMYSQL_INCLUDE_DIR=C:\MySql\include
The -D command line option defines a CMake constant with a given value if needed. When CMake can not find a variable and you know which value it should have, you should give it to CMake with -D when you call it.
Usually the MySQL files you need are found in the Program Files folder.
In my case I installed the MySQL C Connector to the default location that is in C:\Program Files\MySQL\MySQL Connector C 6.1.
You can follow the steps from this similar post to compile the MySQL C++ Connector on Visual Studio 2012.
Note: If you do not want it to be 64bit then on the cmake call change -G "Visual Studio 11 Win64" to -G "Visual Studio 11".
Adding MYSQL_DIR to my computer's environment variables solved the problem.
This dir should be set to MySQL server's dir, to me it is "E:\MySQL\MySQL Server 5.6"
Hope it helps.