I've the following CMakeFiles.txt
cmake_minimum_required (VERSION 3.14.0)
project (awfviewer)
message (STATUS "Building project ${PROJECT_NAME}")
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED ON)
unset (Boost_INCLUDE_DIR CACHE)
unset (Boost_LIBRARY_DIRS CACHE)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON)
find_package (Boost COMPONENTS program_options filesystem REQUIRED)
find_package (Qt5Core REQUIRED)
include_directories (${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIRS})
set (PROJECT_SRC
main.cpp
)
set (PROJECT_QRC
${CMAKE_CURRENT_SOURCE_DIR}/Resources/awfviewer.qrc
)
add_executable (${PROJECT_NAME} ${PROJECT_SRC} ${PROJECT_QRC})
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
qt5_use_modules (${PROJECT_NAME} Widgets Svg)
Building with CMake 3.14.0 I obtain following output:
[cmake] The C compiler identification is MSVC 19.16.27030.1
[cmake] The CXX compiler identification is MSVC 19.16.27030.1
[cmake] Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
[cmake] Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
[cmake] Detecting C compiler ABI info
[cmake] Detecting C compiler ABI info - done
[cmake] Detecting C compile features
[cmake] Detecting C compile features - done
[cmake] Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
[cmake] Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
[cmake] Detecting CXX compiler ABI info
[cmake] Detecting CXX compiler ABI info - done
[cmake] Detecting CXX compile features
[cmake] Detecting CXX compile features - done
[cmake] Building project awfviewer
[cmake] Boost version: 1.69.0
[cmake] Found the following Boost libraries:
[cmake] program_options
[cmake] filesystem
[cmake] Boost version: 1.69.0
[cmake] Boost version: 1.69.0
[cmake] Building project connectiontest
[cmake] Looking for pthread.h
[cmake] Looking for pthread.h - not found
[cmake] Found Threads: TRUE
[cmake] Boost version: 1.69.0
[cmake] Found the following Boost libraries:
[cmake] unit_test_framework
[cmake] log
[cmake] system
[cmake] date_time
[cmake] log_setup
[cmake] filesystem
[cmake] thread
[cmake] regex
[cmake] chrono
[cmake] atomic
[cmake] Building project awfconnectiontest
[cmake] Boost version: 1.69.0
[cmake] Found the following Boost libraries:
[cmake] unit_test_framework
[cmake] log
[cmake] system
[cmake] date_time
[cmake] log_setup
[cmake] filesystem
[cmake] thread
[cmake] regex
[cmake] chrono
[cmake] atomic
[cmake] Configuring done
[cmake] CMake Warning (dev) in src/AWFViewer/CMakeLists.txt:
[cmake] Policy CMP0020 is not set: Automatically link Qt executables to qtmain
[cmake] target on Windows. Run "cmake --help-policy CMP0020" for policy details.
[cmake] Use the cmake_policy command to set the policy and suppress this warning.
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] CMake Warning (dev) in src/AWFViewer/CMakeLists.txt:
[cmake] Policy CMP0020 is not set: Automatically link Qt executables to qtmain
[cmake] target on Windows. Run "cmake --help-policy CMP0020" for policy details.
[cmake] Use the cmake_policy command to set the policy and suppress this warning.
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] CMake Warning (dev) in thirdparty/WRibbon/src/WRibbon/CMakeLists.txt:
[cmake] Policy CMP0020 is not set: Automatically link Qt executables to qtmain
[cmake] target on Windows. Run "cmake --help-policy CMP0020" for policy details.
[cmake] Use the cmake_policy command to set the policy and suppress this warning.
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] CMake Warning (dev) in src/AWFViewer/CMakeLists.txt:
[cmake] Policy CMP0020 is not set: Automatically link Qt executables to qtmain
[cmake] target on Windows. Run "cmake --help-policy CMP0020" for policy details.
[cmake] Use the cmake_policy command to set the policy and suppress this warning.
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] CMake Warning (dev) in thirdparty/WRibbon/src/WRibbon/CMakeLists.txt:
[cmake] Policy CMP0020 is not set: Automatically link Qt executables to qtmain
[cmake] target on Windows. Run "cmake --help-policy CMP0020" for policy details.
[cmake] Use the cmake_policy command to set the policy and suppress this warning.
/// repeat many times
[cmake]
[cmake] Generating done
[cmake] CMake Warning:
[cmake] Manually-specified variables were not used by the project:
[cmake]
[cmake] CMAKE_EXPORT_COMPILE_COMMANDS
[cmake]
[cmake]
[build] Starting build
/// Build starts here
I've read the output of cmake --help-policy CMP0020:
Automatically link Qt executables to qtmain target on Windows.
CMake 2.8.10 and lower required users of Qt to always specify a link
dependency to the qtmain.lib static library manually on Windows.
CMake 2.8.11 gained the ability to evaluate generator expressions
while determining the link dependencies from IMPORTED targets. This
allows CMake itself to automatically link executables which link to Qt
to the qtmain.lib library when using IMPORTED Qt targets. For
applications already linking to qtmain.lib, this should have little
impact. For applications which supply their own alternative WinMain
implementation and for applications which use the QAxServer library,
this automatic linking will need to be disabled as per the
documentation.
The OLD behavior for this policy is not to link executables to
qtmain.lib automatically when they link to the QtCore IMPORTED target.
The NEW behavior for this policy is to link executables to qtmain.lib
automatically when they link to QtCore IMPORTED target.
This policy was introduced in CMake version 2.8.11. CMake version
3.14.0 warns when the policy is not set and uses OLD behavior. Use
the cmake_policy command to set it to OLD or NEW explicitly.
.. note::
The ``OLD`` behavior of a policy is
``deprecated by definition``
and may be removed in a future version of CMake.
But I don't understand what I'm doing wrong by using Qt in the CMake project.
How should I modify the CMakelists.txt in order to use Qt properly and remove the warning?
# Jepessen, I tried to replicate your problem and I got your same error. I bypassed the problem by using an older version of CMake, 3.1 in this case, and also I specified that I wanted to use C++ language using CMAKE_CXX_FLAGS with specific directions -std=c++11. You are totally correct about the documentation you mentioned.
When CMake needs to know the behavior to use it checks if this is specified within the project, and if it is not, then CMake sets the OLD behavior as default. As a consequence of that the warning pops up asking the user to take care of that.
I usually try not to include cmake_policy(policy #) as the majority of them are for older versions and consequently some functionalities could be deprecated and substituted by new versions. Of course there could be situations where cmake_policy(SET CMP<####> NEW) and cmake_policy(SET CMP<####> OLD) have to be specifically addressed.
Below is the working code (it compiles on my computer):
cmake_minimum_required (VERSION 3.1)
project (awfviewer)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
message (STATUS "Building project ${PROJECT_NAME}")
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED ON)
unset (Boost_INCLUDE_DIR CACHE)
unset (Boost_LIBRARY_DIRS CACHE)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON)
find_package (Boost COMPONENTS program_options filesystem REQUIRED)
find_package (Qt5Core REQUIRED)
include_directories (${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/main ${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIRS})
set (PROJECT_SRC)
set (PROJECT_MAIN
main.cpp
)
add_executable (${PROJECT_NAME} ${PROJECT_SRC})
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
In this case the only thing I didn't replicate was creating a QRC file but it does not matter for the small example. Usually CMake is able to recognize and accept older versions of CMake itself given the newer version.
The print screen of what I created in this case is
I hope this could be useful for your project
Related
I wanted to make a GD mod using c++, but when it compiles, i get this error:
[cmake] CMake Error at CMakeLists.txt:5 (project):
[cmake] Generator
[cmake]
[cmake] Unix Makefiles
[cmake]
[cmake] does not support platform specification, but platform
[cmake]
[cmake] darwin
[cmake]
[cmake] was specified.
[cmake]
[cmake]
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Configuring incomplete, errors occurred!
my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.3.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(IlliaGDMod VERSION 1.0.0)
# Use GLOB_RECURSE instead of GLOB
# to recursively add all source files
# under src/
file(GLOB SOURCES
src/*.cpp
)
# Set up the mod binary
add_library(${PROJECT_NAME} SHARED ${SOURCES})
if (NOT DEFINED ENV{GEODE_SDK})
message(FATAL_ERROR "Geode SDK not found")
else()
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
endif()
set(GEODE_LINK_NIGHTLY ON)
add_subdirectory($ENV{GEODE_SDK} $ENV{GEODE_SDK}/build)
target_link_libraries(${PROJECT_NAME} geode-sdk)
create_geode_file(${PROJECT_NAME})
I used VSCode 1.72.2, compiler clang
Does anyone have any ideas on why this happens?
also, i used the visual studio code cmake tools to compile it
I am trying to use OpenCV in VS Code.
Here's what I've done:
Installed OpenCV for windows.
Added "C:\opencv\build\x64\vc15\bin","C:\opencv\build\x64\vc15\lib" PATH environment variable.
Here's my CMakeLists.txt file.
cmake_minimum_required(VERSION 3.0.0)
project(opencvtest VERSION 0.1.0)
include(CTest)
enable_testing()
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable(opencvtest main.cpp)
target_link_libraries( opencvtest ${OpenCV_LIBS} )
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
But the file throws the following error:
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\TDM-GCC-64\bin\x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\TDM-GCC-64\bin\x86_64-w64-mingw32-g++.exe -Hc:/Users/Administrator/Desktop/open -Bc:/Users/Administrator/Desktop/open/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- OpenCV ARCH: x64
[cmake] -- OpenCV RUNTIME: mingw
[cmake] -- OpenCV STATIC: OFF
[cmake] CMake Warning at C:/opencv/build/OpenCVConfig.cmake:190 (message):
[cmake] Found OpenCV Windows Pack but it has no binaries compatible with your
[cmake] configuration.
[cmake]
[cmake] You should manually point CMake variable OpenCV_DIR to your build of OpenCV
[cmake] library.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:7 (find_package)
[cmake]
[cmake]
[cmake] CMake Error at CMakeLists.txt:7 (find_package):
[cmake] Found package configuration file:
[cmake]
[cmake] C:/opencv/build/OpenCVConfig.cmake
[cmake]
[cmake] but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
[cmake] NOT FOUND.
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
I am trying to run a C++ file in VS Code that includes <opencv2/opencv.hpp>.
As the error suggests, CMake found your OpenCV installation, but it is not compatible. What is it not compatible with? Your compiler. The OpenCV installation is built with MSVC 15 (it also includes a 14 build). You have asked CMake to use MinGW as your compiler. Libraries need to have been built with the same (well, with some leeway) compiler for everything to work.
You have two options:
Build OpenCV yourself with MinGW, or try a third-party MinGW binary distribution of OpenCV. Web searches for "opencv mingw" turn up some
possibilities.
Use the MSVC compiler for your project. Microsoft offers some free versions of its tools. Just be sure to install the optional older toolsets so that you have access to the VC 15 tools to match OpenCV.
So My Workspace Screenshot After Trying a while i cant Get Cmake To find the required packages even after i did everything as shown in vcpkg
cmake_minimum_required(VERSION 3.0.0)
project(TEst VERSION 0.1.0)
include(CTest)
enable_testing()
set(CMAKE_TOOLCHAIN_FILE "N:/Vc-PKG/vcpkg/scripts/buildsystems/vcpkg.cmake")
find_package(glfw3 CONFIG REQUIRED)
target_link_libraries(TEst PRIVATE glfw)
add_executable(TEst main.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
and my Vcpkg install directory is N:\Vc-PKG\vcpkg
i also added these lines in vscode
"C_Cpp.default.includePath": [
"N:/Vc-PKG/vcpkg/installed/x64-windows/include",
"N:/Vc-PKG/vcpkg/installed/x86-windows/include",
],
"c-cpp-flylint.cppcheck.includePaths": [
"N:\\Vc-PKG\\vcpkg\\installed\\x64-windows\\include",
"N:\\Vc-PKG\\vcpkg\\installed\\x86-windows\\include",
],
"cmake.generator": "MinGW Makefiles",
The output i get For the following is
[main] Configuring folder: Junks
[proc] Executing command: N:\MSYS64\mingw64\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=N:\MSYS64\mingw64\bin\x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=N:\MSYS64\mingw64\bin\x86_64-w64-mingw32-g++.exe "-Hl:/Programming Projects/Vs Code/Junks" "-Bl:/Programming Projects/Vs Code/Junks/build" -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at CMakeLists.txt:7 (find_package):
[cmake] Could not find a package configuration file provided by "glfw3" with any of
[cmake] the following names:
[cmake]
[cmake] glfw3Config.cmake
[cmake] glfw3-config.cmake
[cmake]
[cmake] Add the installation prefix of "glfw3" to CMAKE_PREFIX_PATH or set
[cmake] "glfw3_DIR" to a directory containing one of the above files. If "glfw3"
[cmake] provides a separate development package or SDK, be sure it has been
[cmake] installed.
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "L:/Programming Projects/Vs Code/Junks/build/CMakeFiles/CMakeOutput.log".
[cmake]
Please any help would be much apricated, sry if i made a mistake this is the 1st time i am posting a question.
You can't set CMAKE_TOOLCHAIN_FILE after the call to project(). That's the command responsible for loading the toolchain file in the first place. Move it before the call to project() or better yet: set it at the command line or in a preset.
Also, unless you're actually using CMake 3.0.0, you shouldn't set it as a minimum. CMake is not forwards compatible, so without actually testing it on the minimum version, you have no way of knowing whether it will work that far back.
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!
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.