I am developing C++ code using VisualStudio 2019.
I am using CMake to configure the project.
I need to use boost library which is compiled on my remote machine.
In console application, I can put the path of the include files I need when I go to the Properties of the project under Additional Include Directories field. And under Additional Include Directories I can put the path of boost library.
Now I can not find Properties when I right-click on my project to add what I need.
My boost include directory is under /home/ubuntu/boost_1_70_0
My boost libraries directory is under /home/ubuntu/boost_1_70_0/stage
How can add them in my CMake project?
Thank you!
EDIT:
This is my CMakelists.txt file:
# CMakeList.txt : CMake project for CMakeProject1, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)
# Add source to this project's executable.
add_executable (CMakeProject1 "CMakeProject1.cpp" "CMakeProject1.h")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.70.0 REQUIRED COMPONENTS lambda)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(CMakeProject1 CMakeProject1.cpp)
target_link_libraries(CMakeProject1 ${Boost_LIBRARIES})
endif()
# TODO: Add tests and install targets if needed.
And this is my .cpp file:
#include "CMakeProject1.h"
#include <iostream>
#include <iterator>
#include <algorithm>
#include <boost/lambda/lambda.hpp>
using namespace std;
int main()
{
typedef std::istream_iterator<int> in;
std::cout << "Type in any number: ";
std::for_each(
in(std::cin), in(), std::cout
<< (boost::lambda::_1 * 10)
<< "\nType in another number: ");
}
The path of my boost directory is: /home/ubuntu/boost_1_70_0
The path of my boost libraries is: /home/ubuntu/boost_1_70_0/stage
When I run the .cpp file this CMake error occurs:
Error CMake Error at CMakeProject1/CMakeLists.txt:13 (find_package): Could not find a package configuration file provided by "Boost" (requested version 1.70.0) with any of the following names:
BoostConfig.cmake boost-config.cmake
Add the installation prefix of "Boost" to CMAKE_PREFIX_PATH or set
"Boost_DIR" to a directory containing one of the above files. If "Boost" provides a separate development package or SDK, be sure it has been installed.