- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我尝试构建一个 CommonApi Some/IP 项目。教程来自这个网站:CommonAPI Some/IP Tutorial
我现在正在尝试使用 cmake gui 构建 cpp-someip-runtime。如果我尝试生成项目,我会收到此错误:
The C compiler identification is MSVC 18.0.21005.1
The CXX compiler identification is MSVC 18.0.21005.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Project name: CommonAPI-SomeIP
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
Boost version: 1.55.0
Found the following Boost libraries:
system
thread
log
chrono
date_time
atomic
log_setup
filesystem
regex
MAX_LOG_LEVEL is set to value: DEBUG
CMake Error at CMakeLists.txt:92 (set):
set called with incorrect number of arguments
CMake Error at CMakeLists.txt:96 (FIND_PACKAGE):
Could not find a package configuration file provided by "CommonAPI"
(requested version 3.1.5) with any of the following names:
CommonAPIConfig.cmake
commonapi-config.cmake
Add the installation prefix of "CommonAPI" to CMAKE_PREFIX_PATH or set
"CommonAPI_DIR" to a directory containing one of the above files. If
"CommonAPI" provides a separate development package or SDK, be sure it has
been installed.
Configuring incomplete, errors occurred!
See also "D:/Programmieren/cplusplus/commonapi/cpp-someip-runtime/build/CMakeFiles/CMakeOutput.log".
See also "D:/Programmieren/cplusplus/commonapi/cpp-someip-runtime/build/CMakeFiles/CMakeError.log".
这是 CMakeLists.txt:
# Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
cmake_minimum_required (VERSION 2.8)
project (CommonAPI-SomeIP)
set (CMAKE_VERBOSE_MAKEFILE off)
set (LIBCOMMONAPI_SOMEIP_MAJOR_VERSION 3)
set (LIBCOMMONAPI_SOMEIP_MINOR_VERSION 1)
set (LIBCOMMONAPI_SOMEIP_PATCH_VERSION 5)
set (USE_INSTALLED_COMMONAPI OFF)
message(STATUS "Project name: ${PROJECT_NAME}")
set (COMPONENT_VERSION ${LIBCOMMONAPI_SOMEIP_MAJOR_VERSION}.${LIBCOMMONAPI_SOMEIP_MINOR_VERSION}.${LIBCOMMONAPI_SOMEIP_PATCH_VERSION})
set (COMMONAPI_API_HEADER_VERSION ${LIBCOMMONAPI_SOMEIP_MAJOR_VERSION}.${LIBCOMMONAPI_SOMEIP_MINOR_VERSION})
SET(PACKAGE_VERSION "${COMPONENT_VERSION}") # used in *.cmake.in
if (MSVC)
# Boost
set(Boost_USE_STATIC_LIBS ON)
set(BOOST_ROOT "C:/portableapps/boost_1_55_0")
find_package( Boost 1.54 COMPONENTS system thread log REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
link_directories(${Boost_LIBRARY_DIR})
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector -fasynchronous-unwind-tables -fno-omit-frame-pointer -DCOMMONAPI_INTERNAL_COMPILATION -D_GLIBCXX_USE_NANOSLEEP")
endif()
SET(MAX_LOG_LEVEL "DEBUG" CACHE STRING "maximum log level")
message(STATUS "MAX_LOG_LEVEL is set to value: ${MAX_LOG_LEVEL}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_INTERNAL_COMPILATION")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_SOMEIP_VERSION_MAJOR=${LIBCOMMONAPI_SOMEIP_MAJOR_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_SOMEIP_VERSION_MINOR=${LIBCOMMONAPI_SOMEIP_MINOR_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_LOGLEVEL=COMMONAPI_LOGLEVEL_${MAX_LOG_LEVEL}")
# Package config module not found message macro
macro (pkg_config_module_not_found_message PKG_CONFIG_MODULE)
message (FATAL_ERROR "pkg-config could not find the required module ${PKG_CONFIG_MODULE}!"
" Please adjust your PKG_CONFIG_PATH environment variable accordingly.")
endmacro ()
# BEGIN TEMPORARY WORKAROUND #
# OS
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set (OS "LINUX")
set (NO_DEPRECATED_REGISTER "")
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set (OS "FREEBSD")
set (NO_DEPRECATED_REGISTER "-Wno-deprecated-register")
endif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
if (NOT MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${OS} ${NO_DEPRECATED_REGISTER} -DBOOST_LOG_DYN_LINK -pthread -g -std=c++0x -O0")
endif()
# END TEMPORARY WORKAROUND #
###################################################################################################
# see http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
###################################################################################################
# Offer the user the choice of overriding the installation directories
set (INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
set (INSTALL_INCLUDE_DIR include/CommonAPI-${COMMONAPI_API_HEADER_VERSION} CACHE PATH "Installation directory for header files")
if (WIN32 AND NOT CYGWIN)
set (DEF_INSTALL_CMAKE_DIR cmake)
else ()
set (DEF_INSTALL_CMAKE_DIR lib/cmake/CommonAPI-SomeIP-${COMPONENT_VERSION})
endif ()
set (INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
# Make relative paths absolute (needed later on)
foreach (p LIB BIN INCLUDE CMAKE)
set (var INSTALL_${p}_DIR)
if (NOT IS_ABSOLUTE "${${var}}")
set (ABSOLUTE_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif ()
endforeach ()
###################################################################################################
set()
if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
else()
FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
endif()
message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
message(STATUS "CommonAPI Version: ${CommonAPI_VERSION}")
# Boost
find_package( Boost 1.54 COMPONENTS system thread log REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )
find_package (vsomeip 2.0.1 REQUIRED)
message(STATUS "vsomeip version: ${vsomeip_VERSION}")
include_directories (
${Boost_INCLUDE_DIR}
${COMMONAPI_INCLUDE_DIRS}
${VSOMEIP_INCLUDE_DIRS}
include
)
file (GLOB CommonAPI-SomeIP_SRC "src/CommonAPI/SomeIP/*.cpp")
if (MSVC)
set (RPCRT Rpcrt4)
else()
set (RPCRT "")
endif()
# CommonAPI
add_library (CommonAPI-SomeIP SHARED ${CommonAPI-SomeIP_SRC})
set_target_properties (CommonAPI-SomeIP PROPERTIES VERSION ${COMPONENT_VERSION} SOVERSION ${LIBCOMMONAPI_SOMEIP_MAJOR_VERSION})
target_link_libraries (CommonAPI-SomeIP CommonAPI vsomeip ${RPCRT})
###################################################################################################
file (GLOB_RECURSE CommonAPI-SomeIP_INCLUDE_INSTALL_FILES "include/*.hpp")
set_target_properties (CommonAPI-SomeIP PROPERTIES PUBLIC_HEADER "${CommonAPI-SomeIP_INCLUDE_INSTALL_FILES}")
install (
TARGETS CommonAPI-SomeIP
# IMPORTANT: Add the CommonAPI-SomeIP library to the "export-set"
EXPORT CommonAPI-SomeIPTargets
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
RUNTIME DESTINATION "${PROJECT_BINARY_DIR}/Bin"
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/CommonAPI/SomeIP"
)
##############################################################################
# exporting, configuring and installing of cmake files
# Add all targets to the build-tree export set
export (TARGETS CommonAPI-SomeIP
FILE "${PROJECT_BINARY_DIR}/CommonAPI-SomeIPTargets.cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export (PACKAGE CommonAPI-SomeIP)
# Create the CommonAPI-SomeIPConfig.cmake and CommonAPI-SomeIPConfigVersion files
file (RELATIVE_PATH REL_INCLUDE_DIR "${ABSOLUTE_INSTALL_CMAKE_DIR}" "${ABSOLUTE_INSTALL_INCLUDE_DIR}")
# ... for the build tree
set (CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-SomeIPConfig.cmake.in
"${PROJECT_BINARY_DIR}/CommonAPI-SomeIPConfig.cmake" @ONLY)
# ... for the install tree
set (CONF_INCLUDE_DIRS "\${COMMONAPI_SOMEIP_CMAKE_DIR}/${REL_INCLUDE_DIR}")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-SomeIPConfig.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CommonAPI-SomeIPConfig.cmake" @ONLY)
# ... for both
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-SomeIPConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/CommonAPI-SomeIPConfigVersion.cmake" @ONLY)
# Install the CommonAPI-SomeIPConfig.cmake and CommonAPI-SomeIPConfigVersion.cmake
install (
FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CommonAPI-SomeIPConfig.cmake"
"${PROJECT_BINARY_DIR}/CommonAPI-SomeIPConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}"
)
# Install the export set for use with the install-tree
install (
EXPORT CommonAPI-SomeIPTargets
DESTINATION "${INSTALL_CMAKE_DIR}"
)
##############################################################################
# create pkg-config file
if(NOT WIN32)
configure_file(CommonAPI-SomeIP.pc.in ${PROJECT_BINARY_DIR}/CommonAPI-SomeIP.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/CommonAPI-SomeIP.pc DESTINATION lib/pkgconfig)
endif()
##############################################################################
# maintainer-clean
add_custom_target(maintainer-clean COMMAND rm -rf *)
我是 Cmake 初学者,所以请尽量从低层次解释我做错了什么。感谢您的帮助!
最佳答案
这里是错误:
CMake Error at CMakeLists.txt:96 (FIND_PACKAGE):
Could not find a package configuration file provided by "CommonAPI"
(requested version 3.1.5) with any of the following names:
CommonAPIConfig.cmake
commonapi-config.cmake
Add the installation prefix of "CommonAPI" to CMAKE_PREFIX_PATH or set
"CommonAPI_DIR" to a directory containing one of the above files. If
"CommonAPI" provides a separate development package or SDK, be sure it has
been installed.
CMake 告诉您它找不到所需的库 CommonAPI。我不太了解这个库,但看起来你正在尝试构建 "CommonAPI C++ SOME/IP",但你需要构建 "CommonAPI Runtime" 首先。它写在您链接的教程中:
If you didn't pass the instructions of the page "CommonAPI C++ D-Bus in 10 minutes" then do it now for step 2 in order to get and build the CommonAPI runtime library.
here 中的第 2 步也是如此首先。
如果您已经这样做但 CMake 仍然找不到它,请将 CommonAPI_DIR
变量设置为包含 CommonAPIConfig.cmake
或 commonapi-config.cmake 的目录
文件。例如:
cmake -DCommonAPI_DIR=/some/path/somewhere ..
关于c++ - CommonAPI CMake 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39331011/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!