Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cmake log4cplus文件无法创建目录管理权限_Cmake_Log4cplus - Fatal编程技术网

Cmake log4cplus文件无法创建目录管理权限

Cmake log4cplus文件无法创建目录管理权限,cmake,log4cplus,Cmake,Log4cplus,我正在尝试使用Cmake安装Log4Cplus 首先,我将log4cplus下载到一个名为3rdparty git clone https://github.com/log4cplus/log4cplus.git --recursive 稍后在common CMakeLists.txt中,我做了以下操作 cmake_minimum_required (VERSION 3.4) enable_testing() include(USR_macros_and_functions.cmake) p

我正在尝试使用Cmake安装Log4Cplus

首先,我将log4cplus下载到一个名为
3rdparty

git clone https://github.com/log4cplus/log4cplus.git --recursive
稍后在common CMakeLists.txt中,我做了以下操作

cmake_minimum_required (VERSION 3.4)
enable_testing()
include(USR_macros_and_functions.cmake)

project (unixpackages)
USR_init_project(unixpackages)
#other packages ...
add_subdirectory(3rdParty/log4cplus)
 #other packages ...
USR_add_build_repo_targets()

问题是,当我尝试构建时,会出现以下错误:

-- Installing: /home/compilation/UnixPackagesFareShopping/Output_API/Lib/libvalidator.so
-- Removed runtime path from "/home/compilation/UnixPackagesFareShopping/Output_API/Lib/libvalidator.so"
CMake Error at 3rdParty/log4cplus/src/cmake_install.cmake:36 (file):
  file cannot create directory: /usr/local/lib64/cmake/log4cplus.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  3rdParty/log4cplus/cmake_install.cmake:37 (include)
  cmake_install.cmake:48 (include)

我知道我没有权利将其安装到
/usr/local/lib64/cmake/
中,但问题是我不知道应该在哪里更改路径以将其指向我有权将其安装到的目录

我试着看看是否能在所有配置和cmake文件中找到lib64,我只找到了这个

./configure:  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
./configure:  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
./m4/libtool.m4:  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,

我是cmake的新手,因此很抱歉出现了评论中的问题

,您可以使用cmake调整安装位置,只需使用
cmake\u INSTALL\u前缀
变量(请参阅的答案)。您可以将此变量设置为您有权访问的位置,因此软件最终将安装在该位置

调用
CMAKE
时,可以在命令行上设置
CMAKE\u INSTALL\u PREFIX
变量,也可以在调用
project
之前在CMAKE文件本身中设置变量,如下所示:

set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/3rdParty/log4cplusclea)

你是说在安装过程中?您可以将while配置设置为具有写入权限的位置,然后重试吗?我在log4cplus的CMakeLists.txt文件中添加了set(CMAKE_INSTALL_PREFIX${PROJECT_SOURCE_DIR}/3rdparty/log4cplus),但不起作用。我还发现了类似于./configure--prefix=/usr/local/httpd的内容,但我不知道应该把它放在哪里。我不想在命令行中添加任何影响整个项目(包括子项目)的变量
CMAKE\u INSTALL\u PREFIX
。(也就是说,您不能将文件安装在
/usr/local
下,而是将与log4cplus相关的文件安装到非系统位置)。请参阅关于正确设置
CMAKE\u INSTALL\u前缀
变量。(引用的问题对命令行和
CMakeLists.txt
文件的修改都有答案。)annd it worked d谢谢@Tsyvarev我做了以下工作:set(CMAKE_INSTALL_PREFIX${PROJECT_SOURCE_DIR}/3rdParty/log4cplusclea缓存路径“CMAKE PREFIX”FORCE)