How wxWidgets cmake find in window - c++

I can't find wxWidget on window. The error is:
CMake Error at E:/Program Files/JetBrains/CLion 2020.2.1/bin/cmake/win/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)`
My Env:
win10
cmake 3.17
wxWidgets 3.1.4
I use cmake to build and install the wxWidgets
mkdir build
cd build
cmake .. -config Release
cmake --build .
cmake --install .
Which install wxWidgets in D:/Program Files(x86)/wxWidgets.
The I set the env variable wxWidgets_ROOT_DIR to D:\Program Files (x86), because that's a code snnipt in cmake's script FindWxWidgets.cmake.
find_path(wxWidgets_ROOT_DIR
NAMES include/wx/wx.h
PATHS
ENV wxWidgets_ROOT_DIR
ENV WXWIN
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" # WX 2.6.x
C:/
D:/
ENV ProgramFiles
PATH_SUFFIXES
wxWidgets-3.1.0
wxWidgets-3.0.2
wxWidgets-3.0.1
wxWidgets-3.0.0
wxWidgets-2.9.5
wxWidgets-2.9.4
wxWidgets-2.9.3
wxWidgets-2.9.2
wxWidgets-2.9.1
wxWidgets-2.9.0
wxWidgets-2.8.9
wxWidgets-2.8.8
wxWidgets-2.8.7
wxWidgets-2.8.6
wxWidgets-2.8.5
wxWidgets-2.8.4
wxWidgets-2.8.3
wxWidgets-2.8.2
wxWidgets-2.8.1
wxWidgets-2.8.0
wxWidgets-2.7.4
wxWidgets-2.7.3
wxWidgets-2.7.2
wxWidgets-2.7.1
wxWidgets-2.7.0
wxWidgets-2.7.0-1
wxWidgets-2.6.4
wxWidgets-2.6.3
wxWidgets-2.6.2
wxWidgets-2.6.1
wxWidgets-2.5.4
wxWidgets-2.5.3
wxWidgets-2.5.2
wxWidgets-2.5.1
wxWidgets
DOC "wxWidgets base/installation directory"
)
I think I have config right the wxWidgets_ROOT_DIR. Because I message the varialbe message(wxWidgets_ROOT_DIR " " ${wxWidgets_ROOT_DIR}) and It show the right value:
D:/Program Files(x86)/wxWidgets
The I use find_libarray(wxWidgets Required) in my project to find wxWidgets, and it shows the above error.
My question is:
How to fix it.
Or what find_package(xxx) do on window?
Update:
I finally find it's clion issue that use his cmake not the stand cmake. I use the stand cmake with vscode. And they works fine.

I also had problems with wxWidgets installation on Windows and CLion, I' ve followed these steps:
Download MinGW(32) and set as the default compiler for CLion (I had problems with other compilers)
Download the windows installer of wxWidgets from the official site (https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.4/wxMSW-3.1.4-Setup.exe)
The installer will download all the files of the library in "C:\wxWidgets-3.1.4" and will also create the environment variable WXWIN that will contain the path of the folder "C:\wxWidgets-3.1.4"
Compile the library following this tutorial for MinGW https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW (make a coffee, it will take a while)
The compiler will but object files in "C:\wxWidgets-3.1.4\lib\gcc_dll", in "C:\wxWidgets-3.1.4\build\msw\gcc_mswudll" and probably in other places based on the instruction files in the "C:\wxWidgets-3.1.3\build" folder
After the compilation you need to add "C:/wxWidgets-3.1.4/lib/gcc_dll" in the environment variable PATH of the OS
After a restart write this code in the CMakeLists of your project:
cmake_minimum_required(VERSION 3.17)
project(your project name)
set(CMAKE_CXX_STANDARD 20)
SET(wxWidgets_USE_LIBS)
#for using RichTextCtrl
FIND_PACKAGE(wxWidgets REQUIRED richtext aui adv html core xml net base)
IF(wxWidgets_FOUND)
INCLUDE("${wxWidgets_USE_FILE}")
add_executable(your list of executables)
TARGET_LINK_LIBRARIES(note ${wxWidgets_LIBRARIES})
ELSE(wxWidgets_FOUND)
#for convenience. When we cannot continue,inform the user
MESSAGE("wxWidgets not found!")
ENDIF(wxWidgets_FOUND)
And now wxWidgets should work

I was able to build the samples using CLion and CMake on Mac OS, but much of what I learned should be similar, given CLion's cross-platform nature. The directions are very long, so here is a link:
https://forums.wxwidgets.org/viewtopic.php?p=197038#p187276

Related

Use CMake to build dependency (oneTBB as git submodule) as dynamic library?

I have a project that depends on Intel's oneTBB. My project is structured as follows:
external/
| - CMakeLists.txt
| - oneTBB/ (this is a git submodule)
| - ...
include/
lib/
include/
CMakeLists.txt
I currently get things to compile by manually building oneTBB and installing it inside a prefix directory located at external/oneTBB/prefix by running the following (bash) commands:
cd oneTBB
mkdir -p prefix
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../prefix -DTBB_TEST=OFF ..
cmake --build .
cmake --install .
I then simply include and link using this prefix. (I got this from following the oneTBB READMEs)
While this works without issue, I'm currently trying to clean up my CMake such that its easier to build on Windows as well. Ideally, I'm looking to get to a point where I can simply run:
mkdir build
cd build
cmake ..
cmake --build .
and my project will build itself and all dependencies.
I got this working with other dependencies such as glfw and eigen by simply adding (to the CMakeLists.txt in external/:
add_subdirectory(glfw)
add_subdirectory(eigen)
But adding add_subdirectory(oneTBB) throws a LOT of warnings, starting with:
CMake Warning at external/oneTBB/CMakeLists.txt:116 (message):
You are building oneTBB as a static library. This is highly discouraged
and such configuration is not supported. Consider building a dynamic
library to avoid unforeseen issues.
-- TBBBind build targets are disabled due to unsupported environment
-- Configuring done
CMake Warning (dev) at external/oneTBB/src/tbb/CMakeLists.txt:15 (add_library):
Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
enabled. Run "cmake --help-policy CMP0069" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
INTERPROCEDURAL_OPTIMIZATION property will be ignored for target 'tbb'.
This warning is for project developers. Use -Wno-dev to suppress it.
I have no need to build oneTBB as a static library.
Am I doing something wrong in my attempt? Really all I need is for oneTBB to be built as a dynamic library and placed somewhere I can link it to (without installing it on the system overall)
Similar question:
I am also including the METIS library which depends on GKlib. Currently I'm doing this in a similar way to what I did for oneTBB where I manually build each using the following script:
# Setup the GKlib library:
cd GKlib
mkdir -p prefix
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../prefix ..
cmake --build . -j
cmake --install .
cd ../../
# Setup the METIS library:
cd METIS
mkdir -p prefix
make config prefix=../prefix gklib_path=../GKlib/prefix #(GKLib path is done from root, install path done relative to build)
make install -j
cd ../
When I try to add them using:
add_subdirectory(GKlib)
add_subdirectory(METIS)
it throws errors that METIS cannot find GKlib:
CMake Error at external/METIS/CMakeLists.txt:50 (add_subdirectory):
add_subdirectory given source "build/xinclude" which is not an existing
directory.
While I recognize this is a separate issue, I figured to include it here as it is related to my issues with add_subdirectory()
Many projects expect that you invoke CMake on them separately instead of adding them into an existing project with add_subdirectory. While there might be a way to make add_subdirectory work with oneTBB, there is an easier way.
CMake has a function that allows you to download, build, and install external projects at build time: ExternalProject_Add.
Here's an example for spdlog, taken straight from one of my own projects:
# project_root/thirdparty/spdlog/CMakeLists.txt
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
ExternalProject_Add(spdlog-project
GIT_REPOSITORY https://github.com/gabime/spdlog
GIT_TAG edc51df1bdad8667b628999394a1e7c4dc6f3658
GIT_SUBMODULES_RECURSE ON
GIT_REMOTE_UPDATE_STRATEGY CHECKOUT
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/install"
LIST_SEPARATOR |
CMAKE_CACHE_ARGS
"-DCMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}:STRING=${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}"
"-DCMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}:STRING=${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}"
"-DCMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UPPER}:STRING=${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}"
"-DCMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UPPER}:STRING=${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}"
"-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
"-DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>"
"-DSPDLOG_BUILD_EXAMPLE:BOOL=OFF"
)
add_library(ext-spdlog INTERFACE)
add_dependencies(ext-spdlog spdlog-project)
ExternalProject_Get_property(spdlog-project INSTALL_DIR)
target_include_directories(ext-spdlog SYSTEM INTERFACE "${INSTALL_DIR}/include")
target_link_directories(ext-spdlog INTERFACE "${INSTALL_DIR}/lib")
target_link_libraries(ext-spdlog INTERFACE spdlog$<$<CONFIG:Debug>:d>)
After that, my project simply links against the created library target:
target_link_libraries(my_project ext-spdlog)
To adapt this for oneTBB, you have to switch out the repository URL and commit hash, and add your own CMake definitions (i.e. "-DTBB_TEST=OFF"). Depending on how oneTBB has its include and library directories set up, you may also have to change the target_include_directories and/or target_link_directories lines. I haven't looked this up yet, but I'm sure you can figure it out.
This works regardless of whether the external project is built as a static or shared library. You shouldn't use git submodules, though - instead, let CMake do the downloading. (It'll only download and build once; subsequent builds will not re-build the external project if it's already built and up-to-date.)
I have no need to build oneTBB as a static library. Am I doing something wrong in my attempt? Really all I need is for oneTBB to be built as a dynamic library and placed somewhere I can link it to (without installing it on the system overall)
All your diagnostic messages indicate that it's actually being configured to be built as a static library, and additional clues point to the probability that you've set BUILD_SHARED_LIBS to false in the scope where you add_subdirectory(oneTBB).
CMake Warning at external/oneTBB/CMakeLists.txt:116 (message):
You are building oneTBB as a static library. This is highly discouraged
and such configuration is not supported. Consider building a dynamic
library to avoid unforeseen issues.
If you look in oneTBB's CMakeLists.txt file, you'll the following:
if (NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
if (NOT BUILD_SHARED_LIBS)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
message(WARNING "You are building oneTBB as a static library. This is highly discouraged and such configuration is not supported. Consider building a dynamic library to avoid unforeseen issues.")
endif()
And then right after that, you get
-- TBBBind build targets are disabled due to unsupported environment
The corresponding section of oneTBB's CMakeLists.txt file is:
if (TBB_FIND_PACKAGE OR TBB_DIR)
...
else()
if (APPLE OR NOT BUILD_SHARED_LIBS)
message(STATUS "TBBBind build targets are disabled due to unsupported environment")
else()
add_subdirectory(src/tbbbind)
endif()
...
Both of these clues indicate that in the variable scope at which you add_subdirectory(oneTBB), BUILD_SHARED_LIBS is set to a falsy value.
Set BUILD_SHARED_LIBS it to a truthy value (Ex. 1, TRUE, YES, ON, etc.) before doing add_subdirectory(oneTBB) and then restore the previous value afterward.
Ex.
set(BUILD_SHARED_LIBS_TEMP "${BUILD_SHARED_LIBS}")
set(BUILD_SHARED_LIBS YES)
add_subdirectory(oneTBB)
set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_TEMP}")
unset(BUILD_SHARED_LIBS_TEMP)

Link SDL2_net with CMake

I'm trying to link SDL2_net (SDL_net 2.0) to my project via CMake, but after searching around I've yet to find a solution. My CMakeLists.txt currently looks like this:
1 cmake_minimum_required (VERSION 3.7)
2 project (SDL_net_test)
3 include (FindPkgConfig)
4 include (FindSDL_net)
5
6 pkg_search_module (SDL2 REQUIRED sdl2)
7 pkg_search_module (SDL_NET REQUIRED sdl2_net)
8
9 include_directories (${SDL2_INCLUDE_DIRS} ${SDL_NET_INCLUDE_DIRS})
10
11 add_executable (SDL_net_test main.cpp)
12 target_link_libraries (SDL_net_test ${SDL2_LIBRARIES} ${SDL_NET_LIBRARIES})
However, when I attempt to run CMake it gives me the following error(s):
-- Could NOT find SDL_net (missing: SDL_NET_LIBRARIES SDL_NET_INCLUDE_DIRS)
-- Checking for one of the modules 'sdl2_net'
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:659 (message):
None of the required 'sdl2_net' found
Call Stack (most recent call first):
CMakeLists.txt:7 (pkg_search_module)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
SDL_NET_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/neboula/Programming/sandbox/sdl2_net
used as include directory in directory /home/neboula/Programming/sandbox/sdl2_net
used as include directory in directory /home/neboula/Programming/sandbox/sdl2_net
SDL_NET_LIBRARY (ADVANCED)
linked by target "SDL_net_test" in directory /home/neboula/Programming/sandbox/sdl2_net
-- Configuring incomplete, errors occurred!
See also "/home/neboula/Programming/sandbox/sdl2_net/build/CMakeFiles/CMakeOutput.log".
I have installed the SDL2_net-devel package from my package manager (dnf on Fedora 29), and I've successfully linked SDL2 and SDL2_image previously basing it on this answer, which worked brilliantly. I also found this, but I'm not entirely sure how to use it. How should I go about this?
Since the person who provided an answer only posted a comment about it, I'll put it down here myself.
The solution was seemingly very simple: I had written pkg_search_module (SDL_NET REQUIRED sdl2_net), while it was supposed to be pkg_search_module (SDL_NET REQUIRED SDL2_net).
To easily integrate the SDL2 library and other related libraries (SDL2_net, SDL2_mixer, ...), I developed modern cross-platform CMake modules that can be used as follows:
Clone SDL2 CMake modules inside our project:
git clone https://github.com/aminosbh/sdl2-cmake-modules cmake/sdl2
Add the following lines in your main CMakeLists.txt
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
find_package(SDL2 REQUIRED)
find_package(SDL2_net REQUIRED)
target_link_libraries(${PROJECT_NAME} SDL2::Main SDL2:Net)
You can even specify a custom path to find the SDL2, SDL2_net, ... useful specially on Windows.
cmake .. -DSDL2_PATH="/path/to/sdl2" -DSDL2_NET_PATH="/path/to/sdl2-net"
For sure, you should not forgot to install the specific packages:
# Fedora/RPM
sudo yum install SDL2-devel SDL2_net-devel
# Debian/Ubuntu
sudo apt install libsdl2-dev libsdl2-net-dev

Qt - How to write a FindXXX.cmake file for a certain Qt library

So I really want to start developing my Qt project inside a different IDE (Clion to be exact). I've written my CMake file for the project. It successfully finds Qt Core, Widgets and other libraries but when it comes to including Qt Charts Cmake throws an error:
CMake Error at CMakeLists.txt:44 (find_package):
By not providing "FindQt5Charts.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Charts", but CMake did not find one.
This error is successfully removed when I add by hand a "FindQt5Charts.cmake" file in my CLion>bin>Cmake>share>modules (where FindQt.cmake and othere search package files are) but as of now this file is empty.
The Cmake compiles successfully but since it hasn't found the library I'm looking for, my project won't compile. I need your help to write "FindQt5Charts.cmake" file because I'm not 100% sure of its syntax.
NOTE: Qt Charts is installed and its folder could be found in Qt's installation directory. I just need the code for the FindQt5Charts.cmake.
Here's a reference to the FindQt.cmake file
Here is how the beggining of my project's cmake looks:
#Pull needed header files generated by QT first
set(QT_GENERATED qtGenerated)
add_custom_target(${QT_GENERATED})
#Get all header files in the directory
file(GLOB QT_GEN_HEADERS ${QT_BIN}/*.h)
#Copy them to the project dir
foreach (QT_GEN_HEADERS ${QT_GEN_HEADERS})
add_custom_command(TARGET ${QT_GENERATED} PRE_BUILD COMMAND
${CMAKE_COMMAND} -E copy_if_different
${QT_GEN_HEADERS} ${CMAKE_SOURCE_DIR})
endforeach ()
# Find the Qt libraries
foreach (QT_LIBRARIES_REQUIRED ${QT_LIBRARIES_REQUIRED})
find_package(${QT_LIBRARIES_REQUIRED} REQUIRED)
endforeach ()

Error during the compilation of DicomToMesh

I'm trying to compile DicomToMesh following this tutorial. At some point,it says to do :
`ccmake ..` #opens ccmake window
Within the ccmake window, pass the path to your vtk installation or vtk build directory. In my case, it looks like that :
CMAKE_BUILD_TYPE DEBUG
CMAKE_INSTALL_PREFIX /usr/local
USE_VTK_DICOM OFF
VTK_DIR /home/eidelen/Development/libs/vtk/build
Press c and then g. Now you are back in terminal and ready to build.
make
well,since after the compilation of the VTK package I got this message :
Build files have been written to: /mnt/c/Users/"Mario
Zio"/Desktop/OrtogOn/Tools/VTK-Release-build"
on the VTK_DIR I tried to write :
/mnt/c/Users/"Mario Zio"/Desktop/OrtogOn/Tools/VTK-Release-build
or
/mnt/c/Users/"Mario Zio"/Desktop/OrtogOn/Tools/VTK-build
but they aren't accepted. The error message is :
CMake Error at lib/CMakeLists.txt:5 (find_package):
By not providing "FindVTK.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "VTK", but CMake did not find one. Could not find a package configuration file provided by "VTK" with any of the following names:
VTKConfig.cmake
vtk-config.cmake
Add the installation prefix of "VTK" to CMAKE_PREFIX_PATH or set "VTK_DIR"
to a directory containing one of the above files. If "VTK" provides a
separate development package or SDK, be sure it has been installed.
Also,according with this thread,I have also used these paths as VTK_DIR inside the ccmake window :
/mnt/c/Users/"Mario Zio"/Desktop/OrtogOn/Tools//VTK-Release-build/bin
/mnt/c/Users/"Mario Zio"/Desktop/OrtogOn/Tools/VTK-build/bin
but the error I get is always the same. What should I do ?
NB 1 : Inside the bin folders of the VTK tool I see no files. Is this correct ?
NB 2 : I'm using the ubuntu bash that I have installed on windows 10.

CMake is not able to find BOOST libraries

I tried everything like:
Configure environment variable
Make fresh build
Re-install BOOST from source
sudo apt-get install libboost-all-dev
But still getting following Errors:
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1131 (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:147 (find_package)
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1131 (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.
Source code directory for boost: /usr/local/src/boost_1_45_0
Boost Library path: /usr/local/lib
Boost Header file: /usr/local/include/boost
Here is bashrc file:
BOOST_ROOT="/usr/local/src/boost_1_45_0"
Boost_LIBRARY_DIRS="/usr/local/lib"
BOOST_INCLUDEDIR="/usr/local/src/boost_1_45_0"
How to solve these Errors? Am i missing something?
Edit:
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN -DBOOST_ROOT=/usr/local/src/boost_1_45_0 -DBOOST_INCLUDEDIR=/usr/local/include/boost -DBOOST_LIBRARYDIR=/usr/local/lib -DPYTHON_LIBRARIES=/usr/local/lib/python2.7 -DPYTHON_INCLUDE_DIRS=/usr/include/python2.7 -DCMA-DRDK_BUILD_PYTHON_WRAPPERS=
Try to complete cmake process with following libs:
sudo apt-get install cmake libblkid-dev e2fslibs-dev libboost-all-dev libaudit-dev
I'm using this to set up boost from cmake in my CMakeLists.txt. Try something similar (make sure to update paths to your installation of boost).
SET (BOOST_ROOT "/opt/boost/boost_1_57_0")
SET (BOOST_INCLUDEDIR "/opt/boost/boost-1.57.0/include")
SET (BOOST_LIBRARYDIR "/opt/boost/boost-1.57.0/lib")
SET (BOOST_MIN_VERSION "1.55.0")
set (Boost_NO_BOOST_CMAKE ON)
FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >= 1.55) required.")
else()
message(STATUS "Setting up BOOST")
message(STATUS " Includes - ${Boost_INCLUDE_DIRS}")
message(STATUS " Library - ${Boost_LIBRARY_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif (NOT Boost_FOUND)
This will either search default paths (/usr, /usr/local) or the path provided through the cmake variables (BOOST_ROOT, BOOST_INCLUDEDIR, BOOST_LIBRARYDIR). It works for me on cmake > 2.6.
I got the same error the first time I wanted to install LightGBM on python (GPU version).
You can simply fix it with this command line :
sudo apt-get install cmake libblkid-dev e2fslibs-dev libboost-all-dev libaudit-dev
the boost libraries will be installed and you'll be fine to continue your installation process.
seems the answer is in the comments and as an edit but to clarify this should work for you:
export BUILDDIR='your path to build directory here'
export SRCDIR='your path to source dir here'
export BOOST_ROOT="/opt/boost/boost_1_57_0"
export BOOST_INCLUDE="/opt/boost/boost-1.57.0/include"
export BOOST_LIBDIR="/opt/boost/boost-1.57.0/lib"
export BOOST_OPTS="-DBOOST_ROOT=${BOOST_ROOT} -DBOOST_INCLUDEDIR=${BOOST_INCLUDE} -DBOOST_LIBRARYDIR=${BOOST_LIBDIR}"
(cd ${BUILDDIR} && cmake ${BOOST_OPTS} ${SRCDIR})
you need to specify the arguments as command line arguments or you can use a toolchain file for that, but cmake will not touch your environment variables.
I just want to point out that the FindBoost macro might be looking for an earlier version, for instance, 1.58.0 when you might have 1.60.0 installed. I suggest popping open the FindBoost macro from whatever it is you are attempting to build, and checking if that's the case. You can simply edit it to include your particular version. (This was my problem.)
Thanks Paul-g for your advise. For my part it was a bit different.
I installed Boost by following the Step 5 of : https://www.boost.org/doc/libs/1_59_0/more/getting_started/unix-variants.html
And then I add PATH directory in the "FindBoos.cmake", located in /usr/local/share/cmake-3.5/Modules :
SET (BOOST_ROOT "../boost_1_60_0")
SET (BOOST_INCLUDEDIR "../boost_1_60_0/boost")
SET (BOOST_LIBRARYDIR "../boost_1_60_0/libs")
SET (BOOST_MIN_VERSION "1.55.0")
set (Boost_NO_BOOST_CMAKE ON)
Long answer to short, if you install boost in custom path, all header files must in ${path}/boost/.
if you want to konw why cmake can't find the requested Boost libraries after you have set BOOST_ROOT/BOOST_INCLUDEDIR, you can check cmake install location path_to_cmake/share/cmake-xxx/Modules/FindBoost.
cmake which will find Boost_INCLUDE_DIR in boost/config.hpp in BOOST_ROOT. That means your boost header file must in ${path}/boost/, any other format (such as ${path}/boost-x.y.z) will not be suitable for find_package in CMakeLists.txt.
I had the same issue inside an alpine docker container, my solution was to add the boost-dev apk library because libboost-dev was not available.