Error on compile tibia source - compilation

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".

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 can find boost but not boost core

I have installed the libboost-all-dev packaged on Ubuntu.
Cmake 3.10.2 can find boost but not "boost_core".
When I change the find package line to:
find_package(Boost REQUIRED COMPONENTS core)
Then it complains that it can't find "boost_core".
I actually just need boost/iterator...
How to make cmake find that?
Thanks.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
project(test_boost_iterator)
set(CMAKE_CXX_STANDARD 11)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
add_definitions( "-DHAS_BOOST" )
add_executable(test_boost_iterator main.cpp)
Success message (before replacing the find_package line):
-- Boost version: 1.65.1
-- Configuring done
-- Generating done
Error message (after replacing the find_package line)
Unable to find the requested Boost libraries.
Boost version: 1.65.1
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_core
No Boost libraries were found. You may need to 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)
As I know there is no such a boost library core. You can check if a library should be linked here.
And Boost.Iterator is a header-only library, so you don't need to link anything. Just include <boost/iterator/...>. If you can't include, check whether these includes actually exist in your local boost distro.
I checked it for boost::counting_iterator<int> and all works well for me.

MSVC build Boost but Cmake findBoost doesn't work?

To reproduce my issue... I download Boost, then I run booststrap and b2 --build-dir=C:\Users\xxx\Downloads\my_boost_build_dir --prefix=C:\Users\xxx\Downloads\my_boost_install_dir --layout=system variant=release link=static install. Everything seems so far so good. The provided prefix (install) dir is populated with headers and libs.
But here's where things start going wrong. If I write the following cmake file...
find_package(Boost REQUIRED)
message("Boost_FOUND" ${Boost_FOUND})
message("Boost_INCLUDE_DIRS" ${Boost_INCLUDE_DIRS})
message("Boost_LIBRARY_DIRS" ${Boost_LIBRARY_DIRS})
message("Boost_LIBRARIES" ${Boost_LIBRARIES})
message("Boost_CHRONO_FOUND" ${Boost_CHRONO_FOUND})
message("Boost_CHRONO_LIBRARY" ${Boost_CHRONO_LIBRARY})
add_executable(main main.cpp)
target_link_libraries(main PRIVATE Boost::boost Boost::chrono)
...and I configure it with the path to the boost install dir cmake .. -DCMAKE_PREFIX_PATH=C:\Users\xxx\Downloads\my_boost_install_dir, then I get the following output and error...
Boost_FOUND1
Boost_INCLUDE_DIRSC:/Users/xxx/Downloads/my_boost_install_dir/include
Boost_LIBRARY_DIRSC:/Users/xxx/Downloads/my_boost_install_dir/lib
Boost_LIBRARIES
Boost_CHRONO_FOUND
Boost_CHRONO_LIBRARY
-- Configuring done
CMake Error at CMakeLists.txt:14 (add_executable):
Target "main" links to target "Boost::chrono" but the target was not found.
Perhaps a find_package() call is missing for an IMPORTED target, or an
ALIAS target is missing?
Boost is found, the include and lib dirs are found, but the chrono library (and all other libraries) are not. Maybe I need to explicitly name my components? So I tried this cmake instead...
find_package(Boost REQUIRED COMPONENTS chrono)
message("Boost_FOUND" ${Boost_FOUND})
message("Boost_INCLUDE_DIRS" ${Boost_INCLUDE_DIRS})
message("Boost_LIBRARY_DIRS" ${Boost_LIBRARY_DIRS})
message("Boost_LIBRARIES" ${Boost_LIBRARIES})
message("Boost_CHRONO_FOUND" ${Boost_CHRONO_FOUND})
message("Boost_CHRONO_LIBRARY" ${Boost_CHRONO_LIBRARY})
add_executable(main main.cpp)
target_link_libraries(main PRIVATE Boost::boost Boost::chrono)
But this produces the following output and error.
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1877 (message):
Unable to find the requested Boost libraries.
Boost version: 1.64.0
Boost include path: C:/Users/xxx/Downloads/my_boost_install_dir/include
Could not find the following Boost libraries:
boost_chrono
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:5 (find_package)
Boost_FOUND0
Boost_INCLUDE_DIRSC:/Users/xxx/Downloads/my_boost_install_dir/include
Boost_LIBRARY_DIRS
Boost_LIBRARIES
Boost_CHRONO_FOUND
Boost_CHRONO_LIBRARY
Like before, it found boost and the headers, but for some reason it can't find the libraries.
If you want to use specific (non-header-only) Boost components, you have to specify them in find_package. In your case:
find_package(Boost COMPONENTS chrono REQUIRED)
According to https://cmake.org/cmake/help/v3.0/module/FindBoost.html
find_package(Boost) follow the hints below to find boost directories:
BOOST_ROOT - Preferred installation prefix (or BOOSTROOT)
BOOST_INCLUDEDIR - Preferred include directory e.g.
/include
BOOST_LIBRARYDIR - Preferred library directory e.g. /lib
Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations
not
specified by these hint variables. Default is OFF.
Boost_ADDITIONAL_VERSIONS
- List of Boost versions not known to this module
(Boost install locations may contain the version)
If you don't know where is the default location to put your boost libraries and include files, you should set these variables before find_package.

could not find the following boost libraries

I am not able to figure out why am I getting this error.
CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/FindBoost.cmake:1753 (message):
Unable to find the requested Boost libraries.
Boost version: 1.48.0
Boost include path: D:/Shark/boost_1_48_0
Could not find the following Boost libraries:
boost_system
boost_date_time
boost_filesystem
boost_program_options
boost_serialization
boost_thread
boost_unit_test_framework
No Boost libraries were found. You may need to 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:146 (find_package)
CMake Error at CMakeLists.txt:154 (message):
Please make sure Boost 1.48.0 is installed on your system
It says, Unable to find requested boost library. But I have installed boost 1.48.0 and build it using Visual studio console, and have passed BOOST_LIBRARYDIR=D:/Shark/boost_1_48_0/stage/lib and BOOST_ROOT=D:/Shark/boost_1_48_0.
CMake's FindBoost macros look for the libs in various spots based on the compiler your using. Even if you specify BOOST_LIBRARYDIR, you still have to conform to the standards the FindBoost macro expects for filenames ie:
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}boost_${COMPONENT} )
Example filenames matching this template for visual studio 2013 (aka msvc 12)
$BOOST_LIBRARY_DIR/boost_atomic-vc120-mt-1_58.dll
$BOOST_LIBRARY_DIR/boost_atomic-vc120-mt-gd-1_58.dll
You'll note that the mt for multithreaded build and the gd to indicate it's a debug build. FindBoost is fussy and will look for the debug build if your CMake project has a CMAKE_BUILD_TYPE=Debug
Additionally if your building multithreaded you'll need to define:
Boost_USE_MULTITHREADED=ON
If your still having trouble you define: Boost_DEBUG=1 and you'll see a lot of additional output about how and where FindBoost is searching.
I was building the boost library by downloading source file. The problem was it was not creating .dll (only .lib).
I downloaded boost binary and installed it from installer to get those files, and set the path BOOL_LIBRARYDIR=C:/local/boost/lib64-msvc-14.0 and BOOL_ROOT=C:/local/boost to make it done.

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