I'm currently working on a school project with Visual Studio 2019, and we face a problem:
LINK : fatal error LNK1104: cannot open file 'Irrlicht.lib'
The error only came when we already have compiled our CMake file, the first time it's working.
My CMakeLists.txt:
cmake_minimum_required(VERSION 3.9)
project(IndieCMAKE)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_CXX_STANDARD 11)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
find_package(Irrlicht)
link_libraries(Irrlicht)
INCLUDE_DIRECTORIES(
"/usr/include/irrlicht"
"./include"
${PROJECT_SOURCE_DIR}/include
)
include_directories(inc)
add_executable(IndieCMAKE
./main.cpp)
Here is my FindIrrlicht.cmake file:
IF (NOT Irrlicht_INCLUDE_DIRS OR NOT Irrlicht_LIBRARIES)
FIND_PATH(Irrlicht_INCLUDE_DIRS
NAMES
irrlicht.h
PATHS
/usr/include/irrlicht/ # Default Fedora28 system include path
/usr/local/include/irrlicht/ # Default Fedora28 local include path
${CMAKE_MODULE_PATH}/include/ # Expected to contain the path to this file for Windows10
${Irrlicht_DIR}/include/ # Irrlicht root directory (if provided)
)
IF (MSVC) # Windows
SET(CMAKE_FIND_LIBRARY_PREFIXES "")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
ELSE (MSVC) # Linux
SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
ENDIF(MSVC)
FIND_LIBRARY(Irrlicht_LIBRARIES
NAMES
Irrlicht
PATHS
/usr/lib64 # Default Fedora28 library path
/usr/lib/ # Some more Linux library path
/usr/lib/x86_64-linux-gnu/ # Some more Linux library path
/usr/local/lib/ # Some more Linux library path
/usr/local/lib64/ # Some more Linux library path
${CMAKE_MODULE_PATH}/ # Expected to contain the path to this file for Windows10
${Irrlicht_DIR}/ # Irrlicht root directory (if provided)
)
ENDIF (NOT Irrlicht_INCLUDE_DIRS OR NOT Irrlicht_LIBRARIES)
IF (Irrlicht_INCLUDE_DIRS AND Irrlicht_LIBRARIES)
SET(Irrlicht_FOUND TRUE)
ELSE (Irrlicht_INCLUDE_DIRS AND Irrlicht_LIBRARIES)
SET(Irrlicht_FOUND FALSE)
ENDIF (Irrlicht_INCLUDE_DIRS AND Irrlicht_LIBRARIES)
IF (Irrlicht_FIND_REQUIRED AND NOT Irrlicht_FOUND)
MESSAGE(FATAL_ERROR
" Irrlicht not found.\n"
" Windows: Fill CMake variable CMAKE_MODULE_PATH to the provided directory.\n"
" Linux: Install Irrlicht using your package manager ($> sudo dnf install irrlicht-devel).\n"
)
ENDIF (Irrlicht_FIND_REQUIRED AND NOT Irrlicht_FOUND)
Here are my CMake GUI variables:
If you are using a CMake Find Module, such as a FindIrrlicht.cmake file, the find_package(Irrlicht) command should populate some Irrlicht_* CMake variables for you. Assuming find_package() actually found the package components correctly, you can use these Irrlicht_* variables in your CMake file to specify where CMake should look for Irrlicht package headers and libraries.
Something like the following CMake file should work:
cmake_minimum_required(VERSION 3.9)
project(IndieCMAKE)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_CXX_STANDARD 11)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
# Use REQUIRED here, to ensure CMake finds the package before continuing.
find_package(Irrlicht REQUIRED)
# Don't use this command. It's old, and the syntax didn't work, in your case.
#link_libraries(Irrlicht)
# Specify your directories that contain headers, including the Irrlicht headers.
include_directories(
${Irrlicht_INCLUDE_DIRS}
)
# Define your executable target.
add_executable(IndieCMAKE
main.cpp
)
# Link the Irrlicht library to your executable target.
target_link_libraries(IndieCMAKE PRIVATE ${Irrlicht_LIBRARIES})
Related
Currently I'm trying to make some spectogram generation for my uni project. I'm trying to build a static library where all the magic will work and just call it from the main() function.
This is my cmake file:
set(CMAKE_CXX_STANDARD 17)
project(demo)
find_package(SndFile REQUIRED)
add_subdirectory(spectogram)
add_executable(demo main.cpp)
target_link_libraries (demo LINK_PUBLIC Spectrogram)
target_link_libraries(demo PRIVATE SndFile::sndfile)
I have installed libsndfile via homebrew, but find_package() refuses to locate the lib and throws this error:
CMake Error at CMakeLists.txt:6 (find_package):
By not providing "FindSndFile.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SndFile", but
CMake did not find one.
Could not find a package configuration file provided by "SndFile" with any
of the following names:
SndFileConfig.cmake
sndfile-config.cmake
Add the installation prefix of "SndFile" to CMAKE_PREFIX_PATH or set
"SndFile_DIR" to a directory containing one of the above files. If
"SndFile" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
I`ve made some research and found out that libsndfile does not have any .cmake configs inside like other libs, that I can link easily (like OpenCV or spdlog). I would really appreciate any help to solve this horror.
With help of Tsyvarev, I figured out the solution. I used the pkg-config module and a custom cmake file, I found on the web. I will include my final cmake in case someone else will need it:
cmake_minimum_required(VERSION 3.17)
set(CMAKE_CXX_STANDARD 17)
project(demo)
# - Try to find libsndfile
# Once done, this will define
#
# LIBSNDFILE_FOUND - system has libsndfile
# LIBSNDFILE_INCLUDE_DIRS - the libsndfile include directories
# LIBSNDFILE_LIBRARIES - link these to use libsndfile
# Use pkg-config to get hints about paths
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(LIBSNDFILE_PKGCONF sndfile)
endif(PKG_CONFIG_FOUND)
# Include dir
find_path(LIBSNDFILE_INCLUDE_DIR
NAMES sndfile.h
PATHS ${LIBSNDFILE_PKGCONF_INCLUDE_DIRS}
)
# Library
find_library(LIBSNDFILE_LIBRARY
NAMES sndfile libsndfile-1
PATHS ${LIBSNDFILE_PKGCONF_LIBRARY_DIRS}
)
find_package(PackageHandleStandardArgs)
find_package_handle_standard_args(LibSndFile DEFAULT_MSG LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR)
if(LIBSNDFILE_FOUND)
set(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY})
set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR})
endif(LIBSNDFILE_FOUND)
mark_as_advanced(LIBSNDFILE_LIBRARY LIBSNDFILE_LIBRARIES LIBSNDFILE_INCLUDE_DIR LIBSNDFILE_INCLUDE_DIRS)
include(FindPkgConfig)
pkg_search_module(SndFile REQUIRED sndfile)
include_directories(${LIBSNDFILE_INCLUDE_DIRS})
add_subdirectory(spectogram)
add_executable(demo main.cpp)
message(STATUS "sndfile include dirs path: ${LIBSNDFILE_INCLUDE_DIRS}")
message(STATUS "sndfile libs path: ${LIBSNDFILE_LIBRARIES}")
target_link_libraries (demo LINK_PUBLIC Spectrogram)
target_link_libraries(demo PRIVATE ${LIBSNDFILE_LIBRARIES})
I am trying to create a CMake file for my project which uses NetCDF. I am very new at CMake (this is my first try), so I apologize if some of this stuff is evident.
To install NetCDF I followed the steps in the git guide shown here
I believe I did the steps correctly. I am trying to use the NetCDF C++ library, but I also had to install the C library for compilation purposes. I did this by using:
sudo apt install libnetcdf-dev
When I run the following command, I receive appropriate output (according to the git guide):
nc-config --has-nc4
So far so good... I hope. Here is my CMakeLists.Txt:
cmake_minimum_required(VERSION 3.16)
project(orbit LANGUAGES CXX)
# ##############################################################################
# Conan Packages
# ##############################################################################
set(CONAN_EXTRA_REQUIRES "") set(CONAN_EXTRA_OPTIONS "")
list(APPEND CONAN_EXTRA_REQUIRES boost/1.73.0) list(APPEND CONAN_EXTRA_REQUIRES eigen/3.3.7)
if(BUILD_SHARED_LIBS) list(APPEND CONAN_EXTRA_OPTIONS "Pkg:shared=True") endif()
include(cmake/Conan.cmake) run_conan()
# ##############################################################################
find_file(CMAKE_PREFIX_PATH netCDFCxxConfig.cmake)
find_package (NetCDF REQUIRED) include_directories(${NETCDF_INCLUDES})
# set(SOURCE test.cpp player.cpp player.hpp)
# include_directories(include)
# Search all .cpp files
file(GLOB_RECURSE SOURCE_FILES "*.cpp")
add_executable(test ${SOURCE_FILES})
target_link_libraries(test
PRIVATE
CONAN_PKG::boost
CONAN_PKG::eigen
${NETCDF_LIBRARIES_CXX})
And here is the error output:
CMake Error at CMakeLists.txt:24 (find_package):
By not providing "FindNetCDF.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "NetCDF", but
CMake did not find one.
Could not find a package configuration file provided by "NetCDF" with any
of the following names:
NetCDFConfig.cmake
netcdf-config.cmake
Add the installation prefix of "NetCDF" to CMAKE_PREFIX_PATH or set
"NetCDF_DIR" to a directory containing one of the above files. If "NetCDF"
provides a separate development package or SDK, be sure it has been
installed.
My understanding is that this error comes from me not doing the following line from the git guide correctly:
Make sure that either nc-config is in your PATH, or that the location of netCDFConfig.cmake is in CMAKE_PREFIX_PATH.
I have tried adding the nc-config to my PATH, by running:
export PATH="nc-config:$PATH"
But this does not resolve the issue...
Additionally, I have tried to find a netCDFConfig.cmake file in my computer, however it does not seem to exist. I do have a netCDFCxxConfig.cmake, but I am not sure if this is the same, or how I could go about using it here.
Does anyone have any experience with this issue, and know how to resolve it? Any help would be greatly appreciated, and I do apologize if such a solution has been provided in the past.
Edit:
I was able to get CMake to finally find the file, but now it gets lost looking for another one... Here is the file it was not finding in my original post:
# NetCDF CXX Configuration Summary
####### Expanded from #PACKAGE_INIT# by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was netCDFCxxConfig.cmake.in ########
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
####################################################################################
include(CMakeFindDependencyMacro)
if (1)
if(EXISTS "")
set(netCDF_ROOT "")
endif()
if(EXISTS "/usr/lib/x86_64-linux-gnu/cmake/netCDF")
set(netCDF_DIR "/usr/lib/x86_64-linux-gnu/cmake/netCDF")
endif()
find_dependency(netCDF)
set(NETCDF_C_LIBRARY ${netCDF_LIBRARIES})
set(NETCDF_C_INCLUDE_DIR ${netCDF_INCLUDE_DIR})
else()
set(NETCDF_C_LIBRARY "netcdf")
set(NETCDF_C_INCLUDE_DIR "/usr/include")
endif()
if (NOT TARGET netCDF::netcdf)
add_library(netCDF::netcdf UNKNOWN IMPORTED)
set_target_properties(netCDF::netcdf PROPERTIES
IMPORTED_LOCATION "${NETCDF_C_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_C_INCLUDE_DIR}"
)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/netcdf-cxx4Targets.cmake")
This last line is where it all sort of goes wrong. Here is where it has issues finding the netcdf-cxx4Targets.cmake.
The file I have just posted is in the directory: netcd-cxx4/build
netcdf-cxx4Targets.cmake is in the directory:
netcd-cxx4/build/CMakeFiles/Export/lib/cmake/netCDF
So the first should be able to find the other?
The netCDFCxxConfig.cmake file is what you want to use. From quickly looking at the GitHub repository, there is a template for this file (netCDFCxxConfig.cmake.in), but not one for netCDFConfig.cmake.in. Therefore, my conclusion is the maintainers probably changed the config file name at some point, and forgot to update their README documentation to netCDFCxxConfig.cmake.
You can add the location of the netCDFCxxConfig.cmake file to the CMAKE_PREFIX_PATH list variable in your CMake file. Then, link to the imported target netCDF::netcdf defined in the netCDFCxxConfig.cmake file.
...
# ##############################################################################
# Don't do this.
find_file(CMAKE_PREFIX_PATH netCDFCxxConfig.cmake)
# Instead, append the path to the config file using the 'list' command.
list(APPEND CMAKE_PREFIX_PATH "/path/to/installed/netcdf")
# Look for the 'netCDFCxx' package, since that is what the config file is called.
find_package (netCDFCxx REQUIRED)
# Probably don't need this if we use the imported target below.
include_directories(${NETCDF_INCLUDES})
# set(SOURCE test.cpp player.cpp player.hpp)
# include_directories(include)
# Search all .cpp files
file(GLOB_RECURSE SOURCE_FILES "*.cpp")
add_executable(test ${SOURCE_FILES})
# Link to the imported target 'netCDF::netcdf' here instead.
target_link_libraries(test
PRIVATE
CONAN_PKG::boost
CONAN_PKG::eigen
netCDF::netcdf)
So I'm using CMake to build a C++ project (on Mac OS) and my project relies on a dylib (I'm using TBB https://www.threadingbuildingblocks.org/ but the specific library itself doesn't matter)
If I do a standard "cmake" and "make" it builds the executable where I want it and when I run my app, the dylib links correctly and everything works perfectly.
The problem comes in when I try to do a "make install" and try to run the resulting executable from the install directory. I get an "image not found" error:
dyld: Library not loaded: #rpath/libtbb.dylib
Referenced from:
/Users/MyName/Desktop/ProjectRoot/install/./MyApp
Reason: image not found
Interestingly, if I do a regular "make" without an install, and then manually copy over the executable to the install directory, then that will link against my dylib properly. I have no idea why that is.
My directory structure is as follows:
Root
CMakeLists.txt
Source/
Libraries/
tbb/
include/
lib/
libtbb.dylib
install/
...and my CMakeLists.txt file is below:
# Start of CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
project (MyApp)
# Set C++ version and output paths
set (CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# Find TBB
find_library (
TBB_LIBRARIES
NAMES tbb libtbb # what to look for
HINTS "${CMAKE_SOURCE_DIR}/Libraries/tbb/lib" # where to look
NO_DEFAULT_PATH # do not search system default paths
)
# Set Custom Include Files + TBB header files
include_directories(Source/Headers Libraries/tbb/include)
# Set Source Files
file(GLOB_RECURSE SRC_FILES "Source/*.cpp")
add_executable(MyApp ${SRC_FILES})
# Link Libraries
target_link_libraries(MyApp ${TBB_LIBRARIES})
# Set compile flags
set_target_properties(MyApp PROPERTIES CXX_STANDARD 14) #LINK_FLAGS "-Wl")
target_compile_features(MyApp PUBLIC cxx_std_14)
# Install executable
install(TARGETS MyApp DESTINATION .)
If I try to also add the following line, and install the dylib as well:
install(TARGETS ${TBB_LIBRARIES} DESTINATION lib)
then when I do a "make install" I get the following error instead:
install TARGETS given target
"/Users/MyName/Desktop/ProjectRoot/Libraries/tbb/lib/libtbb.dylib"
which does not exist in this directory.
So I just can't seem to get this install to work. How do I fix it so that both my executable and my library get installed in the right place and that my executable will be able to link against my library when run?
I have created a project that uses some boost libraries. Originally the project was created as Eclipse project using MinGW and was working correctly. Now I am trying to convert it into CMake project.
I prepare MinGW makefile with CMake and try to compile it but get the following error:
In file included from D:/Krzych/usr/local/include/boost/date_time/c_time.hpp:17:0,
from D:/Krzych/usr/local/include/boost/date_time/time_clock.hpp:16,
from D:/Krzych/usr/local/include/boost/date_time/posix_time/posix_time_types.hpp:10,
from D:/Krzych/usr/local/include/boost/asio/time_traits.hpp:24,
from D:/Krzych/usr/local/include/boost/asio/deadline_timer_service.hpp:27,
from D:/Krzych/usr/local/include/boost/asio/basic_deadline_timer.hpp:25,
from D:/Krzych/usr/local/include/boost/asio.hpp:22,
from D:/Krzych/Projects/Picard/PicardDebugLink/include/CCommunicationAgent.h:22,
from D:\Krzych\Projects\Picard\PicardDebugLink\source\CCommunicationAgent.cpp:12:
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ctime:65:11: error: '::difftime' has not been declared
using ::difftime;
^
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ctime:66:11: error: '::mktime' has not been declared
using ::mktime;
The same kind of error is repeated for every symbol from time.h referenced in ctime. As you can see ctime is directly included by boost date_time library.
Edit -- CMake files --
main CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
project (PicardDebugLink)
# The version number.
set (PicardDebugLink_VERSION_MAJOR 0)
set (PicardDebugLink_VERSION_MINOR 9)
if(WIN32)
macro(get_WIN32_WINNT version)
if (WIN32 AND CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REPLACE "." "" ver ${ver})
string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver})
set(${version} "0x${ver}" CACHE PATH "x")
endif()
endmacro()
get_WIN32_WINNT(platform_code)
add_definitions(-D_WIN32_WINNT=${platform_code})
endif()
# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
"${PROJECT_SOURCE_DIR}/PicardDebugLinkConfig.h.in"
"${PROJECT_BINARY_DIR}/PicardDebugLinkConfig.h"
)
set(CMAKE_CXX_FLAGS "-std=c++11" CACHE STRING "C++2011 features are required" FORCE)
find_package (Boost REQUIRED atomic chrono date_time system timer thread)
include_directories( ${Boost_INCLUDE_DIRS} )
# add the binary tree to the search path for include files
include_directories("${PROJECT_BINARY_DIR}")
include_directories(include)
add_subdirectory(source)
get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
message(status "** inc_dirs: ${inc_dirs}")
# build a CPack driven installer package
# include (InstallRequiredSystemLibraries)
set (CPACK_PACKAGE_VERSION_MAJOR "${TreeEight_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${TreeEight_VERSION_MINOR}")
include (CPack)
File for source subdirectory:
# add the executable
add_library(PicardDebugLink SHARED CCommunicationAgent.cpp
CCommProtocol.cpp
CCreateTest.cpp
CDataStorage.cpp
CException.cpp
CFlashErase.cpp
CFlashFileIOBuff.cpp
CFlashMemIOBuff.cpp
CFlashWriteFile.cpp
CFlashWriteMem.cpp
CFrameCreator.cpp
CIOBuff.cpp
CSerialLink.cpp
ErrorCategories.cpp
FlashProtocols.cpp
IThrowable.cpp
ProgramFPGADataHelpers.cpp
ProgramFPGAProtocols.cpp
SPicardCommunicationFrame.cpp
utilities.cpp
)
get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
target_link_libraries(PicardDebugLink ${Boost_LIBRARIES} )
# add the install targets
install (TARGETS PicardDebugLink DESTINATION bin)
install (FILES "include/*.h" DESTINATION include)
I am having problems at the moment trying to get my cmake to see my opencv.
I have installed opencv and can run the some of the sample problems and some give the same error as the the error I get in my cmake file (when running the sample programs through terminal)
I have tried to change the environment variable path as described in
http://answers.opencv.org/question/35125/cmake-linking-error-opencv_found-to-false-ubuntu/
My bashrc file now looks like
CMAKE_PREFIX_PATH=/home/durham/Desktop/OpenCV/opencv-2.4.9:$CMAKE_PREFIX_PATH
CPATH=/home/durham/Desktop/OpenCV/opencv-2.4.9/include:$CPATH LD_LIBRARY_PATH=/home/durham/Desktop/OpenCV/opencv-2.4.9/lib:$LD_LIBRARY_PATH PATH=/home/durham/Desktop/OpenCV/opencv-2.4.9bin:$PATH
PKG_CONFIG_PATH=/home/durham/Desktop/OpenCV/opencv-2.4.9/lib/pkgconfig:$PKG_CONFIG_PATH
PYTHONPATH=/home/durham/Desktop/OpenCV/opencv-2.4.9/lib/python2.7/dist-packages:$PYTHONPATH
and the contents of /etc/ld.so.conf are
include /etc/ld.so.conf.d/*.conf
include /home/durham/Desktop/OpenCV/opencv-2.4.9
The cmake file I am trying to run looks like this
cmake_minimum_required(VERSION 2.6)
if(POLICY CMP0020) cmake_policy(SET CMP0020 NEW) endif(POLICY CMP0020)
SET(CMAKE_VERBOSE_MAKEFILE TRUE) SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/config)
ADD_DEFINITIONS(-DQT_THREAD_SUPPORT -D_REENTRANT -DQT_NO_DEBUG
-DIQRMODULE)
SET(QT_MT_REQUIRED TRUE) find_package(Qt5Widgets) FIND_PACKAGE(OpenCV REQUIRED)
IF(NOT DEFINED IQR_INCLUDE_DIR) set (IQR_INCLUDE_DIR "/usr/include/iqr") #default for linux ENDIF(NOT DEFINED IQR_INCLUDE_DIR)
IF(NOT EXISTS ${IQR_INCLUDE_DIR}) message(STATUS "not exists IQR_INCLUDE_DIR: ${IQR_INCLUDE_DIR}") set (IQR_INCLUDE_DIR $ENV{IQR_INCLUDE_DIR} CACHE PATH "" FORCE) IF(NOT EXISTS ${IQR_INCLUDE_DIR})
message(STATUS "IQR_INCLUDE_DIR set to ${IQR_INCLUDE_DIR}")
message(FATAL_ERROR "Please specify iqr include directory using IQR_INCLUDE_DIR env. variable") ENDIF(NOT EXISTS ${IQR_INCLUDE_DIR}) ENDIF(NOT EXISTS ${IQR_INCLUDE_DIR})
IF(WIN32) IF(NOT DEFINED IQR_LIB_DIR)
set (IQR_LIB_DIR $ENV{IQR_LIB_DIR} CACHE PATH "" FORCE) ENDIF(NOT DEFINED IQR_LIB_DIR)
IF(NOT EXISTS ${IQR_LIB_DIR})
message(FATAL_ERROR "Please specify phidgets include directory using IQR_LIB_DIR env. variable") ENDIF(NOT EXISTS ${IQR_LIB_DIR}) ENDIF(WIN32)
SET(libSrc
moduleArDroneBottomCamera.cpp
)
INCLUDE_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${IQR_INCLUDE_DIR} ${QT_INCLUDE_DIR} ${OPENCV_INCLUDE_DIR} ardrone_sdk/ ardrone_sdk/VP_SDK/ ardrone_sdk/VLIB/Stages/ ardrone_sdk/VP_SDK/VP_Os/ ardrone_sdk/VP_SDK/VP_Os/linux/ ardrone_sdk/VP_SDK/VP_Stages/ )
ADD_SUBDIRECTORY(ardrone_sdk)
ADD_LIBRARY(moduleArDroneBottomCamera SHARED ${libSrc})
IF(WIN32) set(IQR_LIBS "${IQR_LIB_DIR}/libIqrItem.dll") ENDIF(WIN32)
TARGET_LINK_LIBRARIES (moduleArDroneBottomCamera ${OPENCV_LIBRARIES} pc_ardrone ${QT_LIBRARIES} ${IQR_LIBS} )
qt5_use_modules(moduleArDroneBottomCamera Core Widgets Network)
SET_TARGET_PROPERTIES(moduleArDroneBottomCamera PROPERTIES PREFIX "")
IF(UNIX) set (IQR_INSTALL_DIR $ENV{HOME}) ENDIF(UNIX)
IF(WIN32) set (IQR_INSTALL_DIR $ENV{USERPROFILE}) ENDIF(WIN32)
INSTALL(TARGETS moduleArDroneBottomCamera LIBRARY DESTINATION ${IQR_INSTALL_DIR}/iqr/lib/Modules RUNTIME DESTINATION ${IQR_INSTALL_DIR}/iqr/lib/Modules )
But when I try to generate this using the cmake gui I get the following output (cant post images yet so its in the link)
http://postimg.org/image/4e553z6rh/
I am running Ubuntu 14.04. Any suggestions?
Thanks
D
Fast and dirty solution: try to install opencv (You know, make && sudo make install). After installation header files should be inc /usr/local/include and library files should be in /usr/local/lib .
The problem might lay somewhere ind FindOpenCV.cmake file, so You might as well try to understand what it is doing and maybe fix it - CMake syntax is fairly straightforward.
It might check in a default instalation location instead where it lies right now, or some rarely used environment variable.