CMake cant find Boost - boost

When configuring, the logs show the following in red, I've included version and OS if it helps.
Windows 10
CMake 3.25.1
Boost 1.81.0
Visual Studio 17 2022
CMake Warning at F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported targets
Call Stack (most recent call first):
F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
deps/boost/CMakeLists.txt:35 (find_package)
Boost_DIR = Boost_DIR-NOTFOUND
Boost_FILESYSTEM_LIBRARY_DEBUG = Directory is correct
...
Boost_SYSTEM_LIBRARY_RELEASE = Directory is correct
Just to be on the safe side, I added "BOOST_ROOT" and the directory to both "User variables" and S"ystem variables".
Now, I've already used the bootstrap.bat, followed by the b2.exe. CMake shows the directory for everything else except the BOOST_DIR. When I click on configure, it still shows these errors.

From https://www.azerothcore.org/wiki/windows-core-installation
If you get an error that CMake *Could NOT find Boost (missing: system filesystem program_options iostreams regex) (found suitable version "1.74.0", minimum required is "1.70")
Locate your Boost folder
Run the Bootstrap.bat file
Run the b2.exe file

You can try a diffrent version of boost like latest one 1.81
https://netix.dl.sourceforge.net/project/boost/boost-binaries/1.81.0/boost_1_81_0-msvc-14.3-64.exe
i'm useing this version
don't forget you must edit system variables for this version directory
and don't forget you must use slash / for directory not back slash \ like this:
orginal location: C:\local\boost_1_81_0
on system variables: C:/local/boost_1_81_0
enter image description here

Related

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 Could not find wxWigets

I want to compile a source code on windows using CMake, it uses wxWigets library.
I downloaded the wxWigets from the page: https://www.wxwidgets.org/
After building by Visual Studio, I got the library /lib file.
I have already set PATH for wxWidgets_LIBRARIES and wxWidgets_INCLUDE_DIRS. But the following errors cannot be resolved.
CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.11/Modules/FindwxWidgets.cmake:953 (find_package_handle_standard_args)
CMakeLists.txt:52 (find_package)
I also read the thread about this problem in: CMake could not find wxWidgets on Windows
But there is no solution for my case.
You may specify wxWidgets_ROOT_DIR variable to point to your wxWidgets installation.
As far as I understand, you may set either CMake variable via -D option to cmake:
cmake -DwxWidgets_ROOT_DIR:PATH=D:/path/to/wxWidgets/ ...
or you may set environment variable
set wxWidgets_ROOT_DIR=D:\path\to\wxWidgets\ ...
(Note that CMake path variables use "universal" directory separator '/', but environment variables use native directory separator, '\' for Windows).
This variable is described in documentation for FindwxWidget.
Using wxWidgets_LIB_DIR variable could be tricky, see that question.
I have a solution witch can solve this problem.
there is something wrong with the FindwxWidgets.cmake File
Firstly, delete the file
C:/Program Files/CMake/share/cmake-3.11/Modules/FindwxWidgets.cmake
instead, you can find the package by using wxWidetsConfig.cmake file
YOUR_PATH\wxWidgets\lib\cmake\wxWidgets\wxWidgetsConfig.cmake.
add the flowing codes in your CMakeLists.txt and you can use wxWidgets
# set(CMAKE_PREFIX_PATH C:/dev/wxWidgets) also works
set(CMAKE_PREFIX_PATH C:/dev/wxWidgets/lib/cmake/wxWidgets)
find_package(wxWidgets COMPONENTS core base REQUIRED)
add_executable(wxwdemo WIN32 main.cpp)
target_link_libraries(wxwdemo ${wxWidgets_LIBRARIES})
target_include_directories(wxwdemo PUBLIC ${wxWidgets_INCLUDE_DIRS})
then it works

CMake Error: File /cygdrive/.../src/LLVMBuild.txt does not exist

I'm trying to build cling on Windows7 following the instructions here:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=[Install Path] ..\src
cmake --build . --config [Release/Debug] --target cling
I notice that the compiler cmake is using being Visual Studio 12 2013 (either with cmake-gui or in cmdline), while I get the following error (full traceback is here):
Constructing LLVMBuild project information
CMake Error: File /cygdrive/e/ABOUT-C++/cling/src/LLVMBuild.txt does not exist.
CMake Error at E:/ABOUT-C++/cling/build/LLVMBuild.cmake:28 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:431 (include)
CMake Error: File /cygdrive/e/ABOUT-C++/cling/src/bindings/LLVMBuild.txt does not exist.
CMake Error at E:/ABOUT-C++/cling/build/LLVMBuild.cmake:30 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:431 (include)
Why is the path prefixed with /cygdrive/e/... but not E:/...? Are those valid paths? (The missing files cmake mention DO exist in the corresponding folder!)
Or is that because llvm / clang / cling should be built with cygwin on windows, while the compiler vc12 I'm using by default is incorrect?
My bet is that your problem lies in your python. Judging on D:/cygwin/bin/python2.7.exe it seems that you use special version of python that prepends /cygdrive/ all over the place.
Try using official binary package for Windows.

Error on compile tibia source

I'm trying compile tibia server with CMake 3.1.3 but I'm getting the following error:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindBoost.cmake:1182 (message):
Unable to find the requested Boost libraries.
Boost version: 1.57.0
Boost include path: C:/Users/maria de lourdes/Downloads/boost_1_57_0
Could not find the following Boost libraries:
boost_thread
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)
CMake Error at CMakeLists.txt:7 (find_package):
By not providing "FindGMP.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "GMP", but
CMake did not find one.
Could not find a package configuration file provided by "GMP" with any of
the following names:
GMPConfig.cmake
gmp-config.cmake
Add the installation prefix of "GMP" to CMAKE_PREFIX_PATH or set "GMP_DIR"
to a directory containing one of the above files. If "GMP" provides a
separate development package or SDK, be sure it has been installed.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.1)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
Configuring incomplete, errors occurred!
See also "C:/Tibia/src/build/CMakeFiles/CMakeOutput.log".

CMake reports 'Boost_DIR-NOT_FOUND' when trying to find Boost

I want to build a library called CSWNet on my machine. Cmake can find Boost_INCLUDE_DIR and Boost_LIB_DIR but it cannot find an option called Boost_DIR which is a directory containing a CMake configuration file for Boost. Where is it? Please help, thanks ahead. The error I got is shown below and I installed boost from ubuntu repository and it's installed in /usr/local.
CMake Error at /usr/local/share/cmake-2.8/Modules/FindBoost.cmake:429 (message):
When requesting a specific version of Boost, you must provide at least the
major and minor version numbers, e.g., 1.34
Call Stack (most recent call first):
demos/CMakeLists.txt:149 (find_package)
It seems you misunderstood the meaning of Boost_DIR.
Boost_DIR is an environment variable used as a hint by CMake to find the boost installation directory. If this is set to Boost_DIR-NOTFOUND that does not mean that it did not find Boost. Boost_FOUND is used to indicate whether the search was successful:
find_package(Boost REQUIRED thread)
if(Boost_FOUND)
message(STATUS "Success!")
endif()
In case of a successful search, CMake will also print a diagnostic message during the configure phase which looks something like
Boost version: 1.53.0
Found the following Boost libraries:
thread
Hope its not too late to post this.
Passing it in the command line along with cmake command would resovle it
cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=dist -DBOOST_DIR="boost installation location"

Resources