Could NOT find Freetype (missing: FREETYPE_LIBRARY) on Cmake - cmake

I am trying build the Chlumsky msdfgen library on Windows and I'm using Cmake GUI. No matter what I do I can't get Cmake to configure properly. This library has Freetype as a dependency, and I set the include directories for Freetype, but I constantly get a message that it was not able to find Freetype. How does it know where to look for the Freetype libraries?
CMake Error at C:/Program
Files/CMake/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230
(message): Could NOT find Freetype (missing: FREETYPE_LIBRARY)
(found version "2.12.1")

Related

Use CMake binares to build cpp projects without installing CMake

I want to use specific version of CMake 3.19.0 for Ubuntu 14.04 (32-bits) without installing CMake (use only binaries).
I tried to build CMake 3.19.0 on my test machine. It builded and installed successfully. In install_manifest.txt I see lot of files that were installed on my test system.
So, I tried to copy only installed binaries from /usr/local/bin/ (this is default path where CMake binaries were installed) and paste it to another machine that doesn't know about CMake. I paste 3 binaries: cmake, ctest, cpack to /usr/local/bin/.
If I run which cmake it shows path:
/usr/local/bin/cmake
If I run cmake --verison it shows:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.19
cmake version 3.19.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
It looks like CMake needs some modules that I haven't copied yet. I tried to build my cpp project and it shows me:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.19
CMake Error: Error executing cmake::LoadCache(). Aborting.
What are the minimum required modules needed for stable building? And where I should copy it?
Just copied builded Modules and Templates directories from cmake-3.19.0 build directory to /usr/local/share/cmake-3.19

Building OSRM on Ubuntu, CMake fails with "Intel TBB NOT found!" message

I am following this tutorial to build OSRM-backend from source.
When it says:
cd build
cmake /srv/osrm/osrm-backend/
I got this error message:
ERROR: Intel TBB NOT found!
-- Looked for Threading Building Blocks in /usr
CMake Error at cmake/FindTBB.cmake:274 (message):
Could NOT find TBB library.
Call Stack (most recent call first):
CMakeLists.txt:533 (find_package)
I have installed TBB:
sudo apt install -y libtbb
And it looks good:
/usr/lib/x86_64-linux-gnu/libtbb.so
/usr/lib/x86_64-linux-gnu/libtbb.so.2
(...)
But cmake fails.
I'd go to the file from the error message and see that it can't find the library at some default paths.
It means we have to help cmake a bit. At the beginning we can see that this module respects TBB_INSTALL_DIR. So I'd try setting it while configuring the project.
It's hard to find the solution, althought, it says, there're duplications:
This is a duplicate of #6248 and #6253. Building with
cmake -DENABLE_MASON=ON will fix it.
Surprisingly, on MacOS, there's a simple workaround:
brew install osrm-backend

CMake io2d error missing CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES

I'm trying to follow the steps on this link:https://github.com/cpp-io2d/P0267_RefImpl/blob/master/BUILDING.md
to install io2d.
However I get an error message after I write the cmake ..:
C:\Users\walid\Desktop\Udacity_Nanodegree\RoutePlanningProject\build>cmake ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
CMake Error at CMakeLists.txt:15 (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.
-- Configuring incomplete, errors occurred!
See also "C:/Users/walid/Desktop/Udacity_Nanodegree/RoutePlanningProject/build/CMakeFiles/CMakeOutput.log".
Therefore I found this suggestion On StackOverflow:
CMake third-party library installation
But I get a new error message here it is:
cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
Default IO2D backend was not specified, choosing automatically...
Found Windows, using CAIRO_WIN32.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Error at C:/CMake/cmake-3.17.3-win64-x64/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find Cairo (missing: CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES)
Call Stack (most recent call first):
C:/CMake/cmake-3.17.3-win64-x64/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
cmake/FindCairo.cmake:102 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
P0267_RefImpl/P0267_RefImpl/cairo/CMakeLists.txt:5 (find_package)
PS: I'm using Windows, I have CMake,Make,g++ and gcc installed.
Here is a screenshot demonstrating that I have Cairo already installed:

CMake can't find libevent on macOS

I've installed libevent on macOS -
$ brew install libevent
I'm trying to import it in my CMakeLists.txt -
cmake_minimum_required(VERSION 3.14)
project(xyz)
set(CMAKE_CXX_STANDARD 17)
find_package(libevent REQUIRED)
I get the following CMake error -
CMake Error at CMakeLists.txt:6 (find_package):
By not providing "Findlibevent.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "libevent",
but CMake did not find one.
Could not find a package configuration file provided by "libevent" with any
of the following names:
libeventConfig.cmake
libevent-config.cmake
Add the installation prefix of "libevent" to CMAKE_PREFIX_PATH or set
"libevent_DIR" to a directory containing one of the above files. If
"libevent" provides a separate development package or SDK, be sure it has
been installed.
Could someone please tell how to import libevent installed in the system in CMake?
I have same trouble but I work arond this by adding:
link_directories(
/usr/local/lib
/usr/lib
)
INCLUDE_DIRECTORIES(
/usr/local/include/
/usr/include
)
It just tell the Makefile where to find libevent header and library.

Unable to build libwebsockets library due to CMake missing OpenSSL

I am trying to build libwebsockets on Windows 10 using CMake and MinGW. The library requires OpenSSL.
Environment Variables:
OPENSSL_CONF=C:\Program Files (x86)\OpenSSL-Win32\bin\openssl.cfg
OPENSSL_ROOT_DIR=C:\Program Files (x86)\OpenSSL-Win32
I'm using this to build:
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:/MinGW -DOPENSSL_LIBRARIES="C:\Program Files (x86)\OpenSSL-Win32\lib" -DOPENSSL_CONF="C:\Program Files (x86)\OpenSSL-Win32\openssl.cfg" -DOPENSSL_INCLUDE_DIR="C:\Program Files (x86)\OpenSSL-Win32\include" ..\
The error I get is:
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES) (found version "1.1.0")
I downloaded the OpenSSL binaries from a community build and have used both 64 and 32 versions.
I've even modified the CMake file to confirm the variables were being passed in.
This was a problem with the version of CMake I was using. I upgraded from CMake 3.3.x to 3.6.2 and the build is now successful.