Install ICU libraries for CMake - windows

I am trying to build one windows library with CMake:
The following ICU libraries were not found:
uc (required)
i18n (required)
data (required)
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Failed to find all ICU components (missing: ICU_LIBRARY
_ICU_REQUIRED_LIBS_FOUND) (found version "72.1")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.25/Modules/FindICU.cmake:333 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/MapnikFindPackage.cmake:20 (find_package)
CMakeLists.txt:155 (mapnik_find_package)
I've downloaded release from here: https://github.com/unicode-org/icu/releases/download/release-72-1/icu4c-72_1-Win64-MSVC2019.zip
and unpack it to the c:\icu.
How can I tell CMake where to find ICU binaries?

The rule of thumb is to set CMAKE_PREFIX_PATH with semi-colon separated list of install paths of external libraries: https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html

Related

cannot compile oatpp-curl 1.3.0 under windows

How can I compile oatp-curl under windows?
currently cmake reports a problem for latest oatp-curl release 1.3.0
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/FindPkgConfig.cmake:663 (message):
pkg-config tool not found
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal)
CMakeLists.txt:99 (pkg_check_modules)
I need oatp-curl for oatp rest client

CMake can not find LAPACK library on windows

I'm trying to build a C++ project using CMake which includes LAPACK library on a win32 system.
Following the documentary LAPACK for windows,
I installed MinGW 32 bits and added "C:\MinGW\bin" in the path,
then put downloaded pre-built libraries: libblas.lib, libblas.dll, liblapack.lib, liblapack.dll in the path
"\projectRoot\3rdparty\LAPACK"
The structure of folders is as below:
\projectRoot
\CMakeLists.txt
\3rdparty
\LAPACK
libblas.lib
...
in the CMakeLists file, I added
set(LAPACK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LAPACK")
find_package(LAPACK REQUIRED)
but got error:
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.16/Modules/FindBLAS.cmake:810 (find_package_handle_standard_args)
C:/Program Files/CMake/share/cmake-3.16/Modules/FindLAPACK.cmake:197 (find_package)
CMakeLists.txt:17 (find_package)
and before the error, there's something that CMake couldn't find
Looking for sgemm_
Looking for sgemm_ - not found
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
I can't figure out what's the cause of the problem.
Thank you in advance if you could share your experience.
Answer my own question.
Finally what I did to find the package was:
Copy a built version from jlblancoc/suitesparse-metis-for-windows,
then use config mode of find_package by
set(LAPACK_DIR "dir/to/lapacklibs")
find_package(LAPACK CONFIG REQUIRED)

Cannot build WebKitGTK: missing ICU libraries but cannot install them

I'm trying to build the last release of WebKitGTK (2.28.0) following the instructions they suggest here https://trac.webkit.org/wiki/BuildingGtk#BuildingWebKitGTKfromareleasetarball.
After extracting the downloaded tar.xz, I open that folder in a shell window and run the command:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja
I previously installed Ninja via Homebrew:
brew install ninja
Unfortunately, I get some errors:
-- The following ICU libraries were not found:
-- data (required)
-- i18n (required)
-- uc (required)
CMake Error at /usr/local/Cellar/cmake/3.16.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Failed to find all ICU components (missing: ICU_INCLUDE_DIR ICU_LIBRARY
_ICU_REQUIRED_LIBS_FOUND)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.16.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.16.5/share/cmake/Modules/FindICU.cmake:328 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
Source/cmake/OptionsGTK.cmake:28 (find_package)
Source/cmake/WebKitCommon.cmake:56 (include)
CMakeLists.txt:169 (include)
It seems like some libraries are not installed (data, i18n, uc). After trying to install uc via Homebrew, following the instructions in this StackOverflow answer, the same errors keep showing.
I am on a Mac machine, Mojave v. 10.14.6.

How to find Google Test with find_package using CMake on Windows?

I have tried without success to use the find_package function in CMake to make use of a pre-built "system wide" version of GTest in Windows. Here is a minimal, reproducible example of my CMakeLists.txt:
cmake_minimum_required(VERSION 3.2)
find_package(GTest REQUIRED)
if(NOT GTEST_LIBRARY)
message("GTest not found!")
endif()
I try to generate build files using the following command:
cmake .. -G"Visual Studio 14 2015" -DGTEST_ROOT="c:\Libs\googletest"
The c:\Libs\googletest path contains my pre-built GTest (with header files and binaries). I have studied the FindGTest.cmake file in my CMake installation (I use CMake version 3.13.3) and tried all kinds of folder structure, but I always get the following error message:
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR
GTEST_MAIN_LIBRARY)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.13/Modules/FindGTest.cmake:196 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:2 (find_package)
Has anyone succeeded in using find_package for GTest in Windows? If so, how did you do it?
First you must build AND install Googletest using CMake build system
Then try to locate the GTestConfig.cmake file in the installation directory
So now you can add this path to the CMAKE_PREFIX_PATH variable.
Thus configuring your project using CMake, it should be able to find_package(GTest) using the usual search procedure.
So you just have to use GTest::GTest to consume it (i.e. target_link_libraries(.... GTest::GTest) ).
note: For people using FetchContent/add_subdirectory(googletest) beware google/googletest still not provide ALIAS target see https://github.com/google/googletest/issues/2429

CMake warning: No Boost header defined

I've installed Boost 1.64.0 on a Windows x64 machine.
Using CmakeLists.txt code below
set("BOOST_ROOT" "C:/local/boost_1_64_0/")
set("BOOST_INCLUDEDIR" "C:/local/boost_1_64_0/boost/")
set("BOOST_LIBRARYDIR" "C:/local/boost_1_64_0/lib64-msvc-14.1")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
#find_package(Boost REQUIRED COMPONENTS system filesystem program)
find_package(Boost REQUIRED COMPONENTS
system-vc141-mt-gd-1_64.lib
filesystem-vc141-mt-gd-1_64.lib
program_options-vc141-mt-gd-1_64.lib)
include_directories(${Boost_INCLUDE_DIRS})
I get three warnings, one for each library found:
CMake Warning at C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1566 (message):
No header defined for system-vc141-mt-gd-1_64.lib; skipping header check
Call Stack (most recent call first): CMakeLists.txt:44 (find_package)
CMake Warning at C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1566 (message):
No header defined for filesystem-vc141-mt-gd-1_64.lib; skipping header check
Call Stack (most recent call first): CMakeLists.txt:44 (find_package)
CMake Warning at C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1566 (message):
No header defined for program_options-vc141-mt-gd-1_64.lib; skipping header
check Call Stack (most recent call first): CMakeLists.txt:44 (find_package)
Any ideas how to make cmake find boost headers ?
to answer my question on the source of the problem.
Most likely the Boost installation was not done properly on the machine and the paths of the library were not generated as expected. I will check this again and redo my Boost installation, once more.

Resources