CMake not finding boost libraries from conan - c++

So I'm trying to get my cmake to work with conan/boost. For this I have a simple conan file:
from conans import ConanFile
class Boost_Conan_Cmake_MinimalConfig(ConanFile):
name = "Boost_Conan_Cmake_MinimalConfig"
generators = "cmake"
options = {"shared": [True, False], "st": [True, False]}
default_options = {"shared": False, "st": True}
def requirements(self):
self.requires("boost/1.69.0#_/_")
self.options["boost"].shared = False
I call this via conan install . --build=missing. This runs perfectly fine and installs boost without problems. When investigating into the folder you can also find all the boost libraries etc.
Next comes my CMakeList.txt. It's pretty straight forward:
cmake_minimum_required(VERSION 3.0)
# CHANGE PROJECT NAME, SOURCES AND DEPENDANT TARGETS
project(boost-conan CXX)
include(conanbuildinfo.cmake)
conan_basic_setup()
set(TARGET_NAME ${PROJECT_NAME})
set(${TARGET_NAME}_SRC src/main.cpp)
find_package(Boost 1.69.0 REQUIRED COMPONENTS filesystem)
add_executable(test "src/main.cpp")
target_include_directories(test PUBLIC $(Boost_INCLUDE_DIRS))
target_link_libraries(test Boost::filesystem)
However, when I try to run this CMake file I get an error:
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
-- The CXX compiler identification is MSVC 19.26.28805.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: D:/boost-conan
-- WARN: CONAN_COMPILER variable not set, please make sure yourself that your compiler and version
matches your declared settings
CMake Error at C:/Program Files/CMake/share/cmake-
3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Boost (missing: filesystem) (found suitable version
"1.69.0", minimum required is "1.69.0")
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/FindBoost.cmake:2179 (find_package_handle_standard_args)
CMakeLists.txt:11 (find_package)
-- Configuring incomplete, errors occurred!
See also "D:/boost-conan/CMakeFiles/CMakeOutput.log".
Does anyone have an idea how to fix this? Or does anyone have an idea why this error occurs? The Error message alone doesn't really help...
Thanks in advance!

Related

CMake Can't Find Boost When Changing Visual Studio Target

I am following the instructions from https://badprog.com/c-boost-setting-up-on-windows-10 . I have Visual Studio 2017 installed, and installed boost_1_71_0-msvc-14.1-64.exe. CMake was downloaded from cmake.org/download/, cmake-3.19.0-rc1-win64-x64.msi.
I have a project that needs Boost Beast, which I believe is 1.70 or higher.
When I run cmake . everything seems fine:
C:\Users\Public\xyz>cmake .
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
-- The CXX compiler identification is MSVC 19.24.28314.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - not found
-- Found Threads: TRUE
-- Found Boost: C:/local/boost_1_71_0 (found suitable version "1.71.0", minimum required is "1.70") found components: thread system chrono date_time atomic
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Public/xyz
The resulting project opens in Visual Studio 2017, but then complains it needs the 2019 build tools. Surprisingly, as you can see above, it's building for Visual Studio 2019?
But, after killing CMakeCache.txt and CMakeFiles, if I do this:
C:\Users\Public\xyz>cmake -G "Visual Studio 15 2017" .
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
-- The CXX compiler identification is MSVC 19.16.27034.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find Boost (missing: thread system) (found suitable version
"1.71.0", minimum required is "1.70")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.19/Modules/FindBoost.cmake:2176 (find_package_handle_standard_args)
CMakeLists.txt:29 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Public/xyz/CMakeFiles/CMakeOutput.log".
Suddenly it can't find Boost components (but can find Boost?). I've tried various forms of -DBOOST_LIBRARYDIR or -DBOOST_ROOT, etc., to no avail, but I don't seem to have the usual stackoverflow problem of cmake not being able to find Boost; instead it doesn't seem to recognize the Visual Studio 2017 target, despite having been installed for msvc-14.1?
CMakeLists.txt:
# Specify the minimum version for CMake
cmake_minimum_required(VERSION 3.1)
# Force C++11, for Boost Beast (async http library)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Project's name
project(xyz
VERSION 0.1
LANGUAGES CXX)
# Set the output folder where the program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
# Specify .cpp and .hpp is in src/
set(PROJECT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
include_directories("${PROJECT_SOURCE_DIR}")
# Add source to build target for hello world...
add_executable(main ${PROJECT_SOURCE_DIR}/main.cpp)
# Testing http support
ADD_EXECUTABLE( server ${PROJECT_SOURCE_DIR}/server.cpp )
FIND_PACKAGE( Boost 1.70 REQUIRED COMPONENTS thread system )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
target_link_libraries ( server LINK_PUBLIC ${Boost_LIBRARIES} )
In the end, the issue was simple. If I may so, it was an easy mistake for a beginner to make but almost impossible for a beginner to unravel with regular google searching.
When I issued cmake ., it was defaulting to a 64 bit build, but assuming a Visual Studio 2019 target. That was wrong.
The equivalent should have been cmake -G "Visual Studio 15 2017 Win64" . But not knowing this, and following the wrong tutorials, I was issuing instead cmake -G "Visual Studio 15 2017" .. This defaulted to a 32 bit build - though by default it never mentions this fact. It could find boost, but all library files were for 64 bit and useless for 32 bit, so it simply said "I can't find anything!".
My thanks to #Tsyvarev, who should get the credit for the answer. Turning on DEBUG and looking at searched library files character by character was indeed the right call.

Error while building a cpp application by linking with PCL

I built PCL on windows using VCPKG(MS Visual studio 2017). I am trying to build a CPP application with PCL using cmake 3.12 with the following CMakelists.txt.
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(compute)
find_package(PCL 1.5 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (compute compute.cpp)
target_link_libraries (compute ${PCL_LIBRARIES})
I also set the following environment variables.
set PCL_INCLUDE_DIRS="C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\include\pcl"
SET PCL_LIBRARY_DIRS="C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\lib"
set PCL_LIBRARIES="pcl_common_release.lib;pcl_features_release.lib;pcl_filters_release.lib;pcl_io_ply_release.lib;pcl_io_release.lib"
I initially got an error saying it is unable to find the file FindPCL.cmake and eventually PCLConfig.cmake or PCL-Config.cmake. I set the environment variable
set PCL_DIR=C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\share\pcl
where the PCLConfig.cmake is installed. It was able to detect the file. However,
it is unable to detect PCL(pcl_report_not_found) with the following error.
c:\PCL-Program>cmake .
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27023.1
-- The CXX compiler identification is MSVC 19.16.27023.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Eigen (missing: EIGEN_INCLUDE_DIR)
CMake Error at C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:56 (message):
common is required but eigen was not found
Call Stack (most recent call first):
C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:356 (pcl_report_not_found)
C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:526 (find_external_library)
CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/PCL-Program/CMakeFiles/CMakeOutput.log".
c:\PCL-Program>set EIGEN_INCLUDE_DIR
EIGEN_INCLUDE_DIR=C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\include\Eigen
Even after setting the environment variable for EIGEN_INCLUDE_DIR, I am still getting the same error. Please let me know if I am following the right way.
Thanks!

CMake cannot find requested Boost libraries

Now that I've looked through other peoples solutions for several hours and could not find quite the right answer for my problem I would like to bring my specific problem to you. :)
I am trying to build vsomeip with CMake. For that I previously built boost 1.55, however, I get the following errors in CMake:
The C compiler identification is MSVC 19.0.24215.1
The CXX compiler identification is MSVC 19.0.24215.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visua Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Setting build type to 'RelWithDebInfo' as none was specified.
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/FindBoost.cmake:2025 (message):
Unable to find the requested Boost libraries.
Boost version: 1.55.0
Boost include path: C:/Program Files/boost/boost_1_55_0
Could not find the following static Boost libraries:
boost_system
boost_thread
boost_log
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:99 (find_package)
Boost was not found!
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Systemd was not found, watchdog disabled!
using MSVC Compiler
Predefined unicast address: 127.0.0.1
Predefined diagnosis address: 0x00
Predefined routing application: vsomeipd
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Warning at CMakeLists.txt:335 (message):
Doxygen is not installed. Documentation can not be built.
CMake Warning at CMakeLists.txt:374 (message):
asciidoc is not installed. Readme can not be built.
GTEST_ROOT is not defined. For building the tests the variable
GTEST_ROOT has to be defined. Tests can not be built.
Configuring incomplete, errors occurred!
See also "D:/Desktop/BACHELORARBEIT/vsomeip/build/CMakeFiles /CMakeOutput.log".
See also "D:/Desktop/BACHELORARBEIT/vsomeip/build/CMakeFiles/CMakeError.log".
It cannot find the static Boost libraries. Now, I've tried playing around with the CMakeList.txt and here is the part of it that would be supposed to handle the linking:
# Boost
set(BOOST_INCLUDE_DIR C:/Program Files/Boost/boost_1_55_0)
set(BOOST_LIBRARYDIR C:/Program Files/Boost/boost_1_55_0/stage/libs)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )
if(Boost_FOUND)
if(Boost_LIBRARY_DIR)
MESSAGE( STATUS "Boost_LIBRARY_DIR not empty using it: ${Boost_LIBRARY_DIR}" )
else()
if(BOOST_LIBRARYDIR)
MESSAGE( STATUS "Boost_LIBRARY_DIR empty but BOOST_LIBRARYDIR is set setting Boost_LIBRARY_DIR to: ${BOOST_LIBRARYDIR}" )
set(Boost_LIBRARY_DIR ${BOOST_LIBRARYDIR})
endif()
endif()
else()
MESSAGE( STATUS "Boost was not found!")
endif()
I have also tried using a newer boost version (1.67) with same results. Any help will be dearly appreciated!
Check if your compiled libraries are in the following directory:
C:/Program Files/Boost/boost_1_55_0/stage/libs
If not, set your lib folder directory path:
set(BOOST_LIBRARYDIR path_to_lib_directory)
As #Tsyvarev suggested I used set(Boost_DEBUG ON) to trace the exact locations and files that CMake was looking for and the discovered several problems:
1.) Setting the path to "C:/Program Files/Boost/boost_1_55_0"
causes problems, because of the space in the path
2.) It searched for the libraries covering multiple formats like: boost_thread-vc141-mt-gd-x32-1_55.lib.
However, when I built boost with incorrect parameters, so my libs were built like this:
libboost_thread-vc-mt-1_55.lib, which is not of the correct format.
3.) Unfortunately adding other options when building boost, e.g.:
b2 toolset=msvc-14.1 address-model=32 --build-type=complete
caused other errors. Also building boost_1_67_0 manually worked for me at all.
My solution to the problem was to simply take one of the third-party download( https://dl.bintray.com/boostorg/release/1.67.0/binaries/). This way all the libraries were built correctly and I had no trouble linking to them.

Cannot find MySQL and Boost includes/libs from cmake in windows

I have the following CMakeLists.txt:
cmake_minimum_required(VERSION 3.7)
project(TestProject)
message(STATUS "start running cmake...")
find_package(Boost 1.61.0 COMPONENTS system filesystem REQUIRED)
set(SOURCE_FILES main.cpp)
add_executable(TestProject ${SOURCE_FILES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories(TestProject $ENV{MYSQL_INCLUDE_DIR})
target_link_libraries(TestProject $ENV{MYSQL_LIBRARIES})
if (Boost_FOUND)
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
message(STATUS "Boost_VERSION: ${Boost_VERSION}")
include_directories(TestProject ${Boost_INCLUDE_DIRS})
target_link_libraries(TestProject ${Boost_LIBRARIES})
endif ()
When I run cmake, I get the foloowing output:
> "E:\JetBrains\CLion 2017.1.1\bin\cmake\bin\cmake.exe" -DCMAKE_CXX_COMPILER="F:/MinGW/bin/g++.exe" -DCMAKE_C_COMPILER="F:/MinGW/bin/gcc.exe" -G "MinGW Makefiles" ..
-- The C compiler identification is GNU 6.1.0
-- The CXX compiler identification is GNU 6.1.0
-- Check for working C compiler: F:/MinGW/bin/gcc.exe
-- Check for working C compiler: F:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: F:/MinGW/bin/g++.exe
-- Check for working CXX compiler: F:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- start running cmake...
CMake Warning at E:/JetBrains/CLion 2017.1.1/bin/cmake/share/cmake-3.7/Modules/FindBoost.cmake:744 (message):
Imported targets not available for Boost version
Call Stack (most recent call first):
E:/JetBrains/CLion 2017.1.1/bin/cmake/share/cmake-3.7/Modules/FindBoost.cmake:848 (_Boost_COMPONENT_DEPENDENCIES)
E:/JetBrains/CLion 2017.1.1/bin/cmake/share/cmake-3.7/Modules/FindBoost.cmake:1435 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:6 (find_package)
CMake Warning at E:/JetBrains/CLion 2017.1.1/bin/cmake/share/cmake-3.7/Modules/FindBoost.cmake:744 (message):
Imported targets not available for Boost version
Call Stack (most recent call first):
E:/JetBrains/CLion 2017.1.1/bin/cmake/share/cmake-3.7/Modules/FindBoost.cmake:848 (_Boost_COMPONENT_DEPENDENCIES)
E:/JetBrains/CLion 2017.1.1/bin/cmake/share/cmake-3.7/Modules/FindBoost.cmake:1435 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:6 (find_package)
CMake Error at E:/JetBrains/CLion 2017.1.1/bin/cmake/share/cmake-3.7/Modules/FindBoost.cmake:1793 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)
-- Path to MySQL include directories: E:\MySQL\MySQL Connector C++ 1.1.9\include
-- Path to MySQL library directories: E:\MySQL\MySQL Connector C++ 1.1.9\lib\opt\mysqlcppconn.lib
-- Configuring incomplete, errors occurred!
See also "F:/Ubuntu_Backup/CPPs/build/CMakeFiles/CMakeOutput.log".
If I use this CMakeLists.txt in Clion, the system is able to find the Boost libraries. Following are the entries in CMakeCache.txt that I get from CLion
//The directory containing a CMake configuration file for Boost.
Boost_DIR:PATH=Boost_DIR-NOTFOUND
//Boost filesystem library (debug)
Boost_FILESYSTEM_LIBRARY_DEBUG:FILEPATH=F:/MinGW/lib/libboost_filesystem.a
//Boost filesystem library (release)
Boost_FILESYSTEM_LIBRARY_RELEASE:FILEPATH=F:/MinGW/lib/libboost_filesystem.a
//Path to a file.
Boost_INCLUDE_DIR:PATH=F:/MinGW/include
//Boost library directory DEBUG
Boost_LIBRARY_DIR_DEBUG:PATH=F:/MinGW/lib
//Boost library directory RELEASE
Boost_LIBRARY_DIR_RELEASE:PATH=F:/MinGW/lib
//Boost system library (debug)
Boost_SYSTEM_LIBRARY_DEBUG:FILEPATH=F:/MinGW/lib/libboost_system.a
//Boost system library (release)
Boost_SYSTEM_LIBRARY_RELEASE:FILEPATH=F:/MinGW/lib/libboost_system.a
But when I run cmake separately from the commandline, I get the following in CMakeCache.txt:
//The directory containing a CMake configuration file for Boost.
Boost_DIR:PATH=Boost_DIR-NOTFOUND
//Boost filesystem library (debug)
Boost_FILESYSTEM_LIBRARY_DEBUG:FILEPATH=Boost_FILESYSTEM_LIBRARY_DEBUG-NOTFOUND
//Boost filesystem library (release)
Boost_FILESYSTEM_LIBRARY_RELEASE:FILEPATH=Boost_FILESYSTEM_LIBRARY_RELEASE-NOTFOUND
//Path to a file.
Boost_INCLUDE_DIR:PATH=Boost_INCLUDE_DIR-NOTFOUND
//Boost system library (debug)
Boost_SYSTEM_LIBRARY_DEBUG:FILEPATH=Boost_SYSTEM_LIBRARY_DEBUG-NOTFOUND
//Boost system library (release)
Boost_SYSTEM_LIBRARY_RELEASE:FILEPATH=Boost_SYSTEM_LIBRARY_RELEASE-NOTFOUND
AIM: Get the MySQL and Boost include files and libraries paths correct when building C++ project using cmake
How do I set my env. correctly so that cmake is able to find all the required include file and libraries?
Maybe you have no F:/MinGW/bin in your PATH variable?
Also, which MinGW distro you use? I would recommend you this one http://www.msys2.org/. It has very handy package manager.
You just do
pacman -S mingw-w64-x86_64-boost
and CMake finds boost without any special environment configuration.

Cmake - Could NOT find Boost windows

Hej, I have a problem running my project with Cmake.
But I am getting an error.
"Could NOT find Boost"
I have the boost folder in
"C:\Program Fileenter code heres\PCL 1.6.0\3rdParty\Boost"
images: http://imgur.com/a/YgtQR
At first I got a error popup:
"error in configuration process, projekt files may be invalid"
Than I get this error.
The C compiler identification is MSVC 19.0.24215.1
The CXX compiler identification is MSVC 19.0.24215.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Found eigen: C:/Program Files/PCL 1.6.0/3rdParty/Eigen/include
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
Could NOT find Boost
CMake Error at
C:/Program Files/PCL 1.6.0/cmake/PCLConfig.cmake:39 (message):
common is required but boost was not found
Call Stack (most recent call first):
C:/Program Files/PCL 1.6.0/cmake/PCLConfig.cmake:354 (pcl_report_not_found)
C:/Program Files/PCL 1.6.0/cmake/PCLConfig.cmake:500 (find_external_library)
CMakeLists.txt:5 (find_package)
Configuring incomplete, errors occurred!
See also "//mac/Home/Documents/Visual Studio 2015/Projects/openni_range_image_visualization/build/CMakeFiles/CMakeOutput.log".
See also "//mac/Home/Documents/Visual Studio 2015/Projects/openni_range_image_visualization/build/CMakeFiles/CMakeError.log".
my CMakeLists contains:
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(openni_range_image_visualization)
find_package(PCL 1.3 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (openni_range_image_visualization openni_range_image_visualization.cpp)
target_link_libraries (openni_range_image_visualization ${PCL_LIBRARIES})
This was asked a few years back, but for anybody that is still running into this problem-- the default download instructions on the PCL website help install PCL 1.6.0, which is an old version of PCL that has this little "bug" with regards to boost.
Instead, head over to their Github page and download the latest release here:
https://github.com/PointCloudLibrary/pcl/releases
for this bug has been fixed in the later releases.