Could NOT find Boost (missing: filesystem) (found version "1.64.0") - c++

This is in my CMakeLists.txt:
cmake_minimum_required(VERSION 3.1.0)
project(myProject)
set(EXECUTABLE_OUTPUT_PATH ./bin/${CMAKE_BUILD_TYPE})
find_package(Boost REQUIRED COMPONENTS filesystem)
I compiled Boost 1.64.0 from source. The Boost compilation succeeded, and the filesystem headers are present in the Boost installation directory. I then pointed Boost_INCLUDE_DIR to its base folder (the one containing bootstrap and b2.exe).
I get this CMake output:
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find Boost (missing: filesystem) (found version "1.64.0")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.18/Modules/FindBoost.cmake:2177 (find_package_handle_standard_args)
CMakeLists.txt:9 (find_package)
Configuring incomplete, errors occurred!
What does this mean? How can CMake "NOT find Boost", but find version 1.64.0?

Related

CUDA, Boost and Cmake "string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to command."

I want to use CUDA, Boost for my application and find myself stuck with the following error message
$ cmake ..
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/BoostDetectToolset-1.71.0.cmake:5 (string):
string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
command.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/boost_program_options-1.71.0/boost_program_options-config.cmake:24 (include)
/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:117 (find_package)
/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component)
/home/long/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/211.7442.42/bin/cmake/linux/share/cmake-3.19/Modules/FindBoost.cmake:460 (find_package)
CMakeLists.txt:7 (find_package)
-- Boost toolset is unknown (compiler )
-- Configuring incomplete, errors occurred!
My CMake file looks like following
cmake_minimum_required(VERSION 3.16)
project(chaotic_attractor CUDA)
set(CMAKE_CUDA_STANDARD 14)
find_package(Boost 1.71.0 REQUIRED COMPONENTS program_options)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(chaotic_attractor strangeattractor/main.cu)
target_link_libraries(chaotic_attractor ${Boost_LIBRARIES})
set_target_properties(
chaotic_attractor
PROPERTIES
CUDA_SEPARABLE_COMPILATION ON)
It is not clear to me if NVCC and Boost can get along. Does anyone have an idea how to solve this problem?
Enabling the CXX language here is apparently a requirement for Boost.
cmake_minimum_required(VERSION 3.16)
project(chaotic_attractor LANGUAGES CXX CUDA)
set(CMAKE_CUDA_STANDARD 14)
...

Could NOT find wxWidgets | CMake issue

so I was trying to link to wxWidgets with CMake, and I couldn't get it to work. Here is my CMakeLists.txt.
cmake_minimum_required(VERSION 3.20.1)
set(CMAKE_CXX_STANDARD 20)
project(FormApplication)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(EXE_NAME run)
find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
include(${wxWidgets_USE_FILE})
add_subdirectory(src) # creates an exe named ${EXE_NAME}
target_link_libraries(${EXE_NAME} PRIVATE ${wxWidgets_LIBRARIES})
I get the following error when running cmake -S . -G "Ninja" -B build
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS gl core base)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.20/Modules/FindwxWidgets.cmake:1025 (find_package_handle_standard_args)
CMakeLists.txt:7 (find_package)
Why do I get this error? Every source I go to has a different answer, but none of them have worked so far. Some even say you can't link to wxWidgets with cmake.
Please help, I've been trying to get this to work for a couple days already. Thanks in advance.

How to add MPICH library to CLion project?

I downloaded the mpich-3.3.2 archive (stable release) from the official site, unpacked it and concluded that I have the MPICH library. But I can’t add it to Clion. Here is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.15)
project(MyProject)
set(CMAKE_CXX_STANDARD 17)
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
add_executable(MyProject main.cpp)
I tried to enter different things in CMakeLists.txt, but always the same thing:
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS)
CMake Error at C:/Program Files/JetBrains/CLion 2019.3.4/bin/cmake/win/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Call Stack (most recent call first):
C:/Program Files/JetBrains/CLion 2019.3.4/bin/cmake/win/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/JetBrains/CLion 2019.3.4/bin/cmake/win/share/cmake-3.16/Modules/FindMPI.cmake:1700 (find_package_handle_standard_args)
CMakeLists.txt:6 (find_package)
What am I doing wrong? How should Clion find out the location of MPICH on my computer?

Can't load (external) Boost library into project

I am using CMAKE to try to load Boost library into my project. (I'm using CLion as IDE). Here is my CMAKE file:
cmake_minimum_required(VERSION 3.14)
project(untitled2)
set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_INCLUDE_DIR C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs)
find_package(Boost 1.68.0 COMPONENTS system filesystem REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(untitled2 ${Boost_LIBRARIES})
endif()
add_executable(untitled2 main.cpp)
set(CMAKE_CXX_STANDARD 14)
Here is my directory (C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/):
When reloading CMAKE file I get this error:
CMake Error at C:/Program Files/JetBrains/CLion 2019.1.4/bin/cmake/win/share/cmake-3.14/Modules/FindBoost.cmake:1388 (file):
file STRINGS file
"C:/Users/User/CLionProjects/untitled2/C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs/boost/version.hpp"
cannot be read.
Call Stack (most recent call first):
CMakeLists.txt:8 (find_package)
CMake Error at C:/Program Files/JetBrains/CLion 2019.1.4/bin/cmake/win/share/cmake-3.14/Modules/FindBoost.cmake:2147 (message):
Unable to find the requested Boost libraries.
Boost version: 0.0.0
Boost include path: C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs
Detected version of Boost is too old. Requested version was 1.68 (or
newer).
Call Stack (most recent call first):
CMakeLists.txt:8 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/Users/User/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeOutput.log".
[Failed to reload]
Any suggestions why it fails??

can't add boost to cmake project on cygwin: Imported targets not available for Boost version

I have cygwin in c:\cygwin64 and boost_1_64_0 in /usr/src file. Here is my CMakeLists.txt:
set(BOOST_HOME /usr/src/boost_1_64_0)
set(BOOST_INCLUDEDIR /usr/src/boost_1_64_0/boost)
cmake_minimum_required(VERSION 3.8)
project(spider)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
set(THREADS_PREFER_PTHREAD_FLAG ON)
include_directories(boost ${BOOST_HOME})
find_package(Threads REQUIRED)
find_package(Boost 1.64.0 COMPONENTS system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(spider ${SOURCE_FILES})
target_link_libraries(spider ${Boost_LIBRARIES})
target_link_libraries(spider Threads::Threads)
Clion starts cmake this way:
C:\Users\steve\.CLion2017.2\system\cygwin_cmake\bin\cmake.exe --build C:\Users\steve\Dropbox\Projects\cpp-spider\cmake-build-debug --target spider -- -j 1
I get this error:
CMake Warning at /cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:765 (message):
Imported targets not available for Boost version
Call Stack (most recent call first):
/cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
/cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:17 (find_package)
CMake Warning at /cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:765 (message):
Imported targets not available for Boost version
Call Stack (most recent call first):
/cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
/cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:17 (find_package)
CMake Error at /cygdrive/c/Users/steve/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/FindBoost.cmake:1842 (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:17 (find_package)
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:
Boost_INCLUDE_DIR (ADVANCED)
used as include directory in directory /cygdrive/c/Users/steve/Dropbox/Projects/cpp-spider
used as include directory in directory /cygdrive/c/Users/steve/Dropbox/Projects/cpp-spider
used as include directory in directory /cygdrive/c/Users/steve/Dropbox/Projects/cpp-spider
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/Users/steve/Dropbox/Projects/cpp-spider/cmake-build-debug/CMakeFiles/CMakeOutput.log".
make: *** [Makefile:176: cmake_check_build_system] Error 1
How can I diagnose the reason of the problem? Any idea how I can fix it?