当我为以下旧版库编译项目时: https://github.com/reedhedges/AriaCoda
我得到找不到Aria.h的错误。
我的CMakeLists.txt:
cmake_minimum_required(VERSION 3.14)
project(CLion)
set(CMAKE_CXX_STANDARD 14)
add_executable(CLion
forward.cpp
forward.h
main.cpp
)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
find_package(ARIA)
target_include_directories(CLion PUBLIC ${ARIA_INCLUDE_DIRS})
target_link_libraries(CLion PUBLIC ${ARIA_LIBRARIES})
我的FindARIA.cmake文件:
#############################################################################
#
# ViSP, open source Visual Servoing Platform software.
# Copyright (C) 2005 - 2019 by Inria. All rights reserved.
#
# This software is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# See the file LICENSE.txt at the root directory of this source
# distribution for additional information about the GNU GPL.
#
# For using ViSP with software that can not be combined with the GNU
# GPL, please contact Inria about acquiring a ViSP Professional
# Edition License.
#
# See http://visp.inria.fr for more information.
#
# This software was developed at:
# Inria Rennes - Bretagne Atlantique
# Campus Universitaire de Beaulieu
# 35042 Rennes Cedex
# France
#
# If you have questions regarding the use of this file, please contact
# Inria at visp@inria.fr
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Description:
# Try to find Aria libraries and headers to control Pioneer mobile robots.
# Once run this will define:
#
# ARIA_FOUND
# ARIA_INCLUDE_DIRS
# ARIA_LIBRARIES
#
# Authors:
# Fabien Spindler
#
#############################################################################
find_path(ARIA_INCLUDE_DIR Aria.h
$ENV{ARIA_HOME}/include
/usr/local/Aria/include
/usr/Aria/include
/usr/include
/usr/include/Aria
/usr/local/include
/usr/local/include/Aria
"C:/Program Files/MobileRobots/Aria/include"
)
#MESSAGE("DBG ARIA_INCLUDE_DIR=${ARIA_INCLUDE_DIR}")
if(UNIX)
find_library(ARIA_LIBRARY
NAMES Aria
PATHS
$ENV{ARIA_HOME}/lib
/usr/local/Aria/lib
/usr/Aria/lib
/usr/lib
/usr/local/lib
)
#MESSAGE("DBG ARIA_LIBRARY=${ARIA_LIBRARY}")
else()
if(MSVC14)
set(ARIA_SUFFIX_NAME VC14)
elseif(MSVC12)
set(ARIA_SUFFIX_NAME VC12)
elseif(MSVC11)
set(ARIA_SUFFIX_NAME VC11)
elseif(MSVC10)
set(ARIA_SUFFIX_NAME VC10)
elseif(MSVC90)
set(ARIA_SUFFIX_NAME VC9)
elseif(MSVC80)
set(ARIA_SUFFIX_NAME VC8)
elseif(MSVC71)
set(ARIA_SUFFIX_NAME VC71)
else()
set(ARIA_SUFFIX_NAME "")
endif()
set(ARIA_LIB_SEARCH_PATH "")
if(CMAKE_CL_64)
list(APPEND ARIA_LIB_SEARCH_PATH "C:/Program Files/MobileRobots/Aria/lib64")
list(APPEND ARIA_LIB_SEARCH_PATH $ENV{ARIA_HOME}/lib64)
else()
list(APPEND ARIA_LIB_SEARCH_PATH "C:/Program Files/MobileRobots/Aria/lib")
list(APPEND ARIA_LIB_SEARCH_PATH $ENV{ARIA_HOME}/lib)
endif()
find_library(ARIA_LIBRARY_DEBUG
NAMES AriaDebug${ARIA_SUFFIX_NAME}
PATHS
${ARIA_LIB_SEARCH_PATH}
)
find_library(ARIA_LIBRARY_RELEASE
NAMES Aria${ARIA_SUFFIX_NAME}
PATHS
${ARIA_LIB_SEARCH_PATH}
)
endif()
if(UNIX)
if(ARIA_LIBRARY AND ARIA_INCLUDE_DIR)
set(ARIA_INCLUDE_DIRS ${ARIA_INCLUDE_DIR})
set(ARIA_LIBRARIES ${ARIA_LIBRARY})
set(ARIA_FOUND TRUE)
else()
set(ARIA_FOUND FALSE)
endif()
else()
set(ARIA_LIBRARIES "")
if(ARIA_LIBRARY_RELEASE AND ARIA_INCLUDE_DIR)
set(ARIA_INCLUDE_DIRS ${ARIA_INCLUDE_DIR})
list(APPEND ARIA_LIBRARIES optimized ${ARIA_LIBRARY_RELEASE})
set(ARIA_FOUND TRUE)
endif()
IF(ARIA_LIBRARY_DEBUG AND ARIA_INCLUDE_DIR)
set(ARIA_INCLUDE_DIRS ${ARIA_INCLUDE_DIR})
list(APPEND ARIA_LIBRARIES debug ${ARIA_LIBRARY_DEBUG})
set(ARIA_FOUND TRUE)
endif()
endif()
mark_as_advanced(
ARIA_INCLUDE_DIR
ARIA_LIBRARY
ARIA_LIBRARY_DEBUG
ARIA_LIBRARY_RELEASE
ARIA_LIB_SEARCH_PATH
)
我做错了什么,如何修复或至少改善两个CMAKE文件(我仍在学习CMAKE)?
当前在带有GCC编译器的Windows 10中使用IDE Clion。
最相关的目录来查找此系统上安装的c ++库:
C:\Program Files\MobileRobots\Aria
C:\Program Files\MobileRobots\Aria\include
C:\Program Files\MobileRobots\Aria\bin64
C:\Program Files\MobileRobots\Aria\lib64
我也注意到在find文件(我是从github获得的)中没有目录C:\Program Files\MobileRobots\Aria\bin64
,我相信这个目录是相关的,但无法弄清楚如何将其添加到cmake文件中。
答案 0 :(得分:0)
假设Aria.h
中存在C:/Program Files/MobileRobots/Aria/include
,您可能需要引用空格。 Using CMake's include_directories command with white spaces
我确认命令行上的-I
指令是正确的。
尝试:
target_include_directories(CLion PUBLIC "${ARIA_INCLUDE_DIRS}")
target_link_libraries(CLion PUBLIC "${ARIA_LIBRARIES}")