I'm trying to get mlpack-2.0.1 to work on Visual Studio 14 2015 (I'm using Windows) but have had no success and I've been trying for hours but keep getting the same error: "No C++11 compiler available!" Additionally, I've read a handful of other similar issues on Stack Exchange and none have done the trick. I'm confused because I've been using VS 2015 for months without any errors. Is it possible I changed some compiler setting there and didn't even know it? Should I uninstall visual studio and reinstall it? I've downloaded CMake 3.5.2 and its directory is (the .exe is in the \bin subfolder):
C:\Program Files (x86)\CMake\
The CMakeLists.txt file for mlpack-2.0.1 is found in:
C:\Users\owner\Desktop\C++\
I've used the CMake GUI and command prompt to try to get this to work but have been unable to do the job. I'm not all that sophisticated with changing CMake code so any help would be appreciated. Does anyone know what to do?
You have problem with mlpack:
cmake_minimum_required(VERSION 2.8.5)
project(mlpack C CXX)
# Ensure that we have a C++11 compiler.
include(CMake/CXX11.cmake)
check_for_cxx11_compiler(HAS_CXX11)
if(NOT HAS_CXX11)
message(FATAL_ERROR "No C++11 compiler available!")
endif(NOT HAS_CXX11)
enable_cxx11()
especially with CMake/CXX11.cmake:
macro(check_for_cxx11_compiler _VAR)
message(STATUS "Checking for C++11 compiler")
set(${_VAR})
if((MSVC AND (MSVC10 OR MSVC11 OR MSVC12)) OR
(CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.6) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.1) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 12.0))
set(${_VAR} 1)
message(STATUS "Checking for C++11 compiler - available")
else()
message(STATUS "Checking for C++11 compiler - unavailable")
endif()
endmacro()
So you have to add MSVC14 to condition:
macro(check_for_cxx11_compiler _VAR)
message(STATUS "Checking for C++11 compiler")
set(${_VAR})
if((MSVC AND (MSVC10 OR MSVC11 OR MSVC12 OR MSVC13 OR MSVC14)) OR
(CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.6) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.1) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 12.0))
set(${_VAR} 1)
message(STATUS "Checking for C++11 compiler - available")
else()
message(STATUS "Checking for C++11 compiler - unavailable")
endif()
endmacro()
Try this.
Related
Trying to install a plugin to Gazebo 11 on my Macbook Air M1. I will try to perform co-simulation between Simulink and Gazebo. After extracting gazeboplugin.zip , I applied
mkdir build
cd build
Then I tried
cmake ..
I got an error
CMake Error at CMakeLists.txt:32 (message):
The compiler /Library/Developer/CommandLineTools/usr/bin/c++ has no C++11
support. Please use a different C++ compiler.
Then I solved this by changing cmakelists.txt from
#/* Copyright 2019-2020 The MathWorks, Inc. */
##########################################
# CMakeLists.txt for gazebo_plugin_for_simulink #
##########################################
cmake_minimum_required(VERSION 2.8)
PROJECT(gazebo_plugin_for_simulink)
#################################
# Specify the CMake module path #
#################################
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
# Check C++11 or C++0x support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-DCOMPILEDWITHC11)
message(STATUS "Using flag -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
add_definitions(-DCOMPILEDWITHC0X)
message(STATUS "Using flag -std=c++0x.")
elseif(COMPILER_SUPPORTS_CXX17)
set (CMAKE_CXX_STANDARD 17)
message(STATUS "Using C++17 standard")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -Wno-deprecated-declarations -Wno-unused-function")
ENDIF()
find_package(Boost 1.58.0 REQUIRED COMPONENTS date_time)
find_package(gazebo REQUIRED)
# Gazebo Minumum Supported version number
SET(GAZEBO_MIN_SUPPORTED_VERSION "9")
# Gazebo Maximum Supported version number
SET(GAZEBO_MAX_SUPPORTED_VERSION "11")
message(STATUS "Found Gazebo ${GAZEBO_VERSION}: major version is ${GAZEBO_MAJOR_VERSION}")
# Validate Installed Gazebo version
if("${GAZEBO_MAJOR_VERSION}" VERSION_LESS "${GAZEBO_MIN_SUPPORTED_VERSION}" OR "${GAZEBO_MAJOR_VERSION}" VERSION_GREATER "${GAZEBO_MAX_SUPPORTED_VERSION}" )
message(FATAL_ERROR "\nThe installed version of Gazebo is not supported for Gazebo Co-Simulation Plugin generation.\n"
" The Gazebo Co-Simulation Plugin supports,\n"
" minimum Gazebo version: gazebo ${GAZEBO_MIN_SUPPORTED_VERSION}.x series\n"
" maximum Gazebo version: gazebo ${GAZEBO_MAX_SUPPORTED_VERSION}.x series\n")
endif()
include_directories(
include/
msgsproto/
${Boost_INCLUDE_DIR}
${GAZEBO_INCLUDE_DIRS}
)
link_directories(
${GAZEBO_LIBRARY_DIRS}
)
###############################################
# USE => cmake .. -DTESTING=ON to trun ON testing
option(TESTING "plugin testing" OFF)
if(TESTING)
ADD_SUBDIRECTORY(msgsproto/pkgtest)
endif()
ADD_SUBDIRECTORY(msgsproto)
ADD_SUBDIRECTORY(src/transport)
ADD_SUBDIRECTORY(src/gazeboserver)
ADD_SUBDIRECTORY(src/gazebocustom)
ADD_SUBDIRECTORY(src/gazeboplugin)
if(TESTING)
ADD_SUBDIRECTORY(src/gazeboplugin/pkgtest)
ADD_SUBDIRECTORY(src/gazeboserver/gazebomsghandler/pkgtest)
ADD_SUBDIRECTORY(src/gazebocustom/gazebocustommsghandler/pkgtest)
endif()
to
# Sets the C++ compiler
# Available: C++11, C++14 and C++17
cmake_minimum_required(VERSION 3.25)
project(ProjectName)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if( (${CMAKE_VERSION} VERSION_GREATER "3.8.2") OR (${CMAKE_VERSION} VERSION_EQUAL "3.8.2") )
if(COMPILER_SUPPORTS_CXX17)
set (CMAKE_CXX_STANDARD 17)
message(STATUS "Using C++17 standard")
elseif(COMPILER_SUPPORTS_CXX14)
set (CMAKE_CXX_STANDARD 14)
message(STATUS "Using C++14 standard")
elseif(COMPILER_SUPPORTS_CXX11)
set (CMAKE_CXX_STANDARD 11)
message(STATUS "Using C++11 standard")
elseif(COMPILER_SUPPORTS_CXX0X)
set (CMAKE_CXX_STANDARD 11)
message(STATUS "Using C++11 standard")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or above support. Please use a different C++ compiler.")
endif()
else()
if(COMPILER_SUPPORTS_CXX14)
set (CMAKE_CXX_STANDARD 14)
message(STATUS "Using C++14 standard")
elseif(COMPILER_SUPPORTS_CXX11)
set (CMAKE_CXX_STANDARD 11)
message(STATUS "Using C++11 standard")
elseif(COMPILER_SUPPORTS_CXX0X)
set (CMAKE_CXX_STANDARD 11)
message(STATUS "Using C++11 standard")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or above support. Please use a different C++ compiler.")
endif()
endif()
After solving ( I guess ) this issue I got this after making cmake ..
mfurkanozata#Furkans-MacBook-Air build % cmake ..
-- Using C++17 standard
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mfurkanozata/src/GazeboPlugin
Finally I aplly make command and got nothing. The plugin was not built and as usual after applying
gazebo ../world/multiSensorPluginTest.world --verbose
I got this error
[Err] [Plugin.hh:212] Failed to load plugin lib/libGazeboCoSimPlugin.so: dlopen(lib/libGazeboCoSimPlugin.so, 0x0009): tried: 'lib/libGazeboCoSimPlugin.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlib/libGazeboCoSimPlugin.so' (no such file), '/opt/homebrew/Cellar/gazebo11/11.12.0_2/lib/../lib/lib/libGazeboCoSimPlugin.so' (no such file), '/opt/homebrew/Cellar/gazebo11/11.12.0_2/bin/../lib/lib/libGazeboCoSimPlugin.so' (no such file), '/usr/lib/lib/libGazeboCoSimPlugin.so' (no such file, not in dyld cache), 'lib/libGazeboCoSimPlugin.so' (no such file)
Failed to load plugin lib/libGazeboCoSimPlugin.dylib: dlopen(lib/libGazeboCoSimPlugin.dylib, 0x0009): tried: 'lib/libGazeboCoSimPlugin.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlib/libGazeboCoSimPlugin.dylib' (no such file), '/opt/homebrew/Cellar/gazebo11/11.12.0_2/lib/../lib/lib/libGazeboCoSimPlugin.dylib' (no such file), '/opt/homebrew/Cellar/gazebo11/11.12.0_2/bin/../lib/lib/libGazeboCoSimPlugin.dylib' (no such file), '/usr/lib/lib/libGazeboCoSimPlugin.dylib' (no such file, not in dyld cache), 'lib/libGazeboCoSimPlugin.dylib' (no such file)
Can you help me in this issue?
I'm attempting to add OpenMP to a project that is building with CMake. I'm having no problem building it on Linux with the standard CMake/OpenMP addition:
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}
${OpenMP_EXE_LINKER_FLAGS}")
endif()
Unfortunately this doesn't seem to work on macOS targets. When cmake is called, the following error is given:
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS)
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
I'm using macOS High Sierra (10.13.3) along with CMake 3.11. I've installed OpenMP 5.01 via brew, 'brew install libomp'. I've found some previous posts commenting on issues regarding these three but they all seem to deal with a previous way of installing OpenMP on macOS, "brew install clang-omp".
I'm thinking this might have something to do with CMake not support this OpenMP install as I'm able to use OpenMP no problem with standard makefiles. Any information provided would be much appreciated.
I've been able to answer my own question (apologies for not figuring this out beforehand, hopefully this can help others with the same issue).
It seems that a patch has been submitted to CMake to allow it to properly create buildsystems with the new OpenMP install: https://gitlab.kitware.com/cmake/cmake/merge_requests/1812
For others seeing this in the future, update to CMake 3.12 if it has been released at the time of reading.
I had the same problem and it took one complete day to find the solution. I am using Mac-Sierra 10.13.4. I want to use Opencv3 (I think the same problem also appears for opencv2) and openMP. I was actually using Clion as the IDE (CLion uses cmake to configure the project unlike other IDE), so I have to write the CMakeLists.txt file.
There was a conflict of using gcc as the compiler for openCV and openMP. If you use gcc as the compiler then it gives error for opencv as :
imwrite() on OS X error: Undefined symbols
You need to specifically use llvm compiler on OS X to resolve this issue. Following, I am giving the correct code for using OpenCV and OpenMP on Mac-Sierra:
cmake_minimum_required(VERSION 3.10)
project(MyOpenCVTest)
set(CMAKE_CXX_STANDARD 11)
add_executable(MyOpenCVTest main.cpp)
# set("OpenCV_DIR" "/modules/opencv/3.4.1/share/OpenCV/")
set(CMAKE_PREFIX_PATH "/usr/local/Cellar/opencv#3/")
set(OpenCV_INCLUDE_DIRS "/usr/local/Cellar/opencv#3/include/")
set(OpenCV_LIBS "/usr/local/Cellar/opencv#3/lib/")
find_package(OpenCV REQUIRED)
message(STATUS "OpenCV library status:")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
if(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x")
endif()
set(CMAKE_C_COMPILER "/usr/local/Cellar/llvm/6.0.0/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/local/Cellar/llvm/6.0.0/bin/clang++")
set(OPENMP_LIBRARIES "/usr/local/Cellar/llvm/6.0.0/lib")
set(OPENMP_INCLUDES "/usr/local/Cellar/llvm/6.0.0/include")
OPTION (USE_OpenMP "Use OpenMP to enamble <omp.h>" ON)
# Find OpenMP
if(APPLE AND USE_OpenMP)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(OpenMP_C "${CMAKE_C_COMPILER}")
set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
endif()
endif()
if(USE_OpenMP)
find_package(OpenMP REQUIRED)
endif(USE_OpenMP)
if (OPENMP_FOUND)
include_directories("${OPENMP_INCLUDES}")
link_directories("${OPENMP_LIBRARIES}")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif(OPENMP_FOUND)
include_directories( ${OpenCV_INCLUDE_DIRS} )
target_link_libraries( MyOpenCVTest ${OpenCV_LIBS})
TARGET_LINK_LIBRARIES(MyOpenCVTest opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs)
You might want to set e.g. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread") such that the linker automatically detects the appropriate pthread library
Do
brew reinstall llvm
to install llvm compiler.
Please note that, you can't use gcc compiler on Mac-Sierra for your project which needs openMP and also openCV. You need to use llvm compiler.
Verify the correct location of llvm and openCV installation directory.
I am porting my code from Linux to Windows. On Windows, I need to link to libqwt.a in release mode and libqwtd.a in debug mode.
IF OS==Windows AND CMAKE_BUILD_TYPE==Debug
I'm trying to have find_library() find libqwtd.a
ELSE
find libqwt.a
But it only finds libqwt.a.
Here is the CMake code :
include_directories("${QWT_DIR}/include")
set(QWT_LIB_NAME qwt)
if (WIN32)
message(STATUS "OS=windows")
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(QWT_LIB_NAME qwtd)
set(CMAKE_FIND_LIBRARY_SUFFIXES "d.a")
message(STATUS "Build=debug, Qwt lib="${QWT_LIB_NAME})
endif (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
endif (WIN32)
message(STATUS "Searching Qwt lib="${QWT_LIB_NAME})
find_library(LIB_QWT ${QWT_LIB_NAME} PATHS "${QWT_DIR}/lib" NO_DEFAULT_PATH)
message(STATUS "LIB_QWT=${LIB_QWT}")
target_link_libraries(${PROJECT_NAME} "${LIB_QWT}")
And here is the output :
QWT_DIR=C:/lib/Qwt-6.1.4
OS=windows
Build=debug, Qwt lib=qwtd
Searching Qwt lib=qwtd
LIB_QWT=C:/lib/Qwt-6.1.4/lib/libqwt.a
As Tsyvarev pointed out, I needed to delete CMakeCache.txt in the build directory. So now, the code to handle Windows (debug and release) and Linux builds shrinks down to :
include_directories("${QWT_DIR}/include")
set(QWT_NAME qwt)
if ( (WIN32) AND (${CMAKE_BUILD_TYPE} STREQUAL "Debug") )
set(QWT_NAME qwtd)
endif ( (WIN32) AND (${CMAKE_BUILD_TYPE} STREQUAL "Debug") )
find_library(LIB_QWT ${QWT_NAME} PATHS "${QWT_DIR}/lib" NO_DEFAULT_PATH)
message(STATUS "Found LIB_QWT=${LIB_QWT}")
target_link_libraries(${PROJECT_NAME} "${LIB_QWT}")
My high level goal is to install the BGSlibrary which requires boost for python on Windows 10 using Visual Studio 2017. I compiled opencv and boost (1.64.0) from source using cmake 3.9.0. During cmake for BGSLIBRARY I get
$ cmake -DBGS_PYTHON_SUPPORT=ON -DBOOST_ROOT="C:/Program Files/boost_1_64_0/" ..
-- BGSLIBRARY WITH PYTHON SUPPORT: ON
-- OpenCV library status:
-- version: 3.3.0
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.9/ Modules/FindBoost.cmake:1877 (message):
Unable to find the requested Boost libraries.
Boost version: 1.64.0
Boost include path: C:/Program Files/boost_1_64_0
Could not find the following Boost libraries:
boost_python
No Boost libraries were found. You may need to 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:75 (find_package)
I've seen lots of questions on the cmake findboost module. Okay lets start from here.
I downloaded and extract boost 1.64.0 and placed it here
I ran bootstrap.bat and .b2 to generate the build boost
C:\Program Files\boost_1_64_0>b2 toolset=msvc-14.1 --with-python --user-config=user-config.jam
with a user config
import toolset : using ;
using msvc : 14.1 ;
using python
: 2.7 # Version
: C:\\Python27\\python.exe # Interpreter
: C:\\Python27\\include # inc dir
: C:\\Python27\\libs # link libs
: # conditions
;
I can see python source here
and can confirm that from within the Visual Studio 2017 command prompt I build boost with python support and it finds all targets successfully.
I can see a bunch of "python" .lib files here. Reading other questions suggests that is where it goes.
But I can't seem to get cmake to see it.
I've tried changing the name libboost_python to boost_python. I've tried pointing in cmake -DBOOST_ROOT, or -DBOOST_LIBRARYDIR (or non-debg, -BOOST_LIBRARYDIR). I've tried adding to the lib dir to PATH. But nothing seems to work. Is this a cmake problem, a incomplete boost installation or a problem with BGSLibrary?
EDIT
To answer #utopia, the CMakeList section in question reads
if(BGS_PYTHON_SUPPORT)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost REQUIRED COMPONENTS python)
find_package(PythonLibs REQUIRED)
message(STATUS "Boost library status:")
message(STATUS " version: ${Boost_VERSION}")
message(STATUS " libraries: ${Boost_LIBRARIES}")
message(STATUS " include path: ${Boost_INCLUDE_DIRS}")
message(STATUS "Python library status:")
message(STATUS " version: ${PYTHON_VERSION}")
message(STATUS " libraries: ${PYTHON_LIBRARIES}")
message(STATUS " include path: ${PYTHON_INCLUDE_DIRS}")
endif()
Does this mean that the .lib should be literally named python.lib? With no other characters or perhaps boost_python.lib. Is it that specific?
Building Boost.Python
#utopia led me to the right solution. The .lib needs to be literally named boost_python.lib, not appended with the visual studio compiler version, boost version etc. I was able to successfully build after that, no cmake flags needed.
I'm on Windows 10 and got this error when generating solution using CMake-GUI:
CMake Warning at C:/Program Files/CMake/share/cmake-3.8/Modules/FindBoost.cmake:765 (message):
Imported targets not available for Boost version
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
I know it's been asked and answered here CMake finds Boost but the imported targets not available for Boost version
but the solution in there (upgrading CMake) doesn't work for me, still get the same error after upgrading from 3.7 to 3.8
Update
My boost version is 106300.
Content of CMakeList file is below:
# doc/CMakeLists.txt uses configure_file behavior from CMake 2.8
cmake_minimum_required(VERSION 2.8)
project(tpie)
include_directories(.)
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
#### CONFIG.H Checks:
include(CheckIncludeFiles)
if(NOT WIN32)
add_definitions("-Wall -Wextra")
endif(NOT WIN32)
if(WIN32)
add_definitions("-DWIN32_LEAN_AND_MEAN /bigobj")
endif(WIN32)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
#### Dependencies
## Boost
set(Boost_ADDITIONAL_VERSIONS "1.40.0" "1.40" "1.41" "1.41.0" "1.42" "1.42.0" "1.43" "1.43.0" "1.44" "1.44.0" "1.45" "1.45.0")
set(Boost_USE_MULTITHREADED ON)
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
endif(WIN32)
find_package(Boost COMPONENTS date_time filesystem system REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories( ${Boost_LIBRARY_DIRS} )
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if(TPIE_FRACTIONDB_DIR_INL)
include_directories(${TPIE_FRACTIONDB_DIR_INL})
endif(TPIE_FRACTIONDB_DIR_INL)
check_include_files("unistd.h" TPIE_HAVE_UNISTD_H)
check_include_files("sys/unistd.h" TPIE_HAVE_SYS_UNISTD_H)
# Ryan Pavlik's Git revision description helper
# http://stackoverflow.com/a/4318642
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_COMMIT)
## Snappy
option(TPIE_USE_SNAPPY "Use Snappy, a fast compressor/decompressor" ON)
if(TPIE_USE_SNAPPY)
find_package(Snappy)
if(${Snappy_FOUND})
set(TPIE_HAS_SNAPPY ON)
include_directories(${Snappy_INCLUDE_DIR})
else(${Snappy_FOUND})
set(TPIE_HAS_SNAPPY OFF)
endif(${Snappy_FOUND})
endif(TPIE_USE_SNAPPY)
#### Installation paths
#Default paths
set(BIN_INSTALL_DIR bin)
set(LIB_INSTALL_DIR lib)
set(HEADERS_INSTALL_DIR include/tpie)
if (WIN32)
set(DOC_INSTALL_DIR doc)
else(WIN32)
set(DOC_INSTALL_DIR "share/doc/tpie")
endif(WIN32)
set(INSTALL_TARGETS_DEFAULT_ARGS
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if (CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} bt)
string(REGEX MATCH " -DNDEBUG " TPIE_NDEBUG " ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${bt}} ")
else()
option(TPIE_NDEBUG "Disable debugging information" ON)
endif()
set(TPIE_S ${CMAKE_CURRENT_SOURCE_DIR})
set(TPIE_B ${CMAKE_CURRENT_BINARY_DIR})
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tpie/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/tpie/config.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tpie/config.h DESTINATION ${HEADERS_INSTALL_DIR})
add_subdirectory(tpie)
add_subdirectory(doc)
option(COMPILE_TEST "Compile test programs" ON)
option(TPL_LOGGING "Enable tpie logging." ON)
option(TPIE_DEPRECATED_WARNINGS "Enable warnings for deprecated classes, methods and typedefs" OFF)
option(TPIE_PARALLEL_SORT "Enable parallel quick sort implementation" ON)
if (COMPILE_TEST)
ENABLE_TESTING()
add_subdirectory(test)
add_subdirectory(apps)
endif (COMPILE_TEST)
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_CONTACT "rav#cs.au.dk")
set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "TPIE")
set(CPACK_PACKAGE_VENDOR "The TPIE maintainers")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.md")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "TPIE ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
if(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
#set(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\thomasmoelhave.github.com/tpie/")
set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\thomasmoelhave.github.com/tpie/")
set(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
set(CPACK_NSIS_MODIFY_PATH ON)
list(APPEND CPACK_GENERATOR NSIS)
else(WIN32 AND NOT UNIX)
list(APPEND CPACK_GENERATOR DEB)
endif(WIN32 AND NOT UNIX)
install(DIRECTORY tpie
DESTINATION include
FILES_MATCHING REGEX "\\.h$|\\.inl$"
PATTERN "deadcode" EXCLUDE)
install(DIRECTORY share/tpie
DESTINATION share)
include(CPack)
Any other idea? tks
Your CMAKE is too old for the boost 1.63.
Reinstall a newer CMAKE or do this(according to FindBoost.cmake source code in cmake/share/cmake-3.9/Modules/FindBoost.cmake line 516):
Note: to add a new Boost release, run
% cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake
Or, Just modify that line from
elseif(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106300)
to
elseif(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106500)