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

时间:2018-08-29 10:25:25

标签: cmake log4cplus

我正在尝试使用Cmake安装Log4Cplus。

首先,我将log4cplus下载到名为3rdparty的目录中

git clone https://github.com/log4cplus/log4cplus.git --recursive

稍后在常见的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的新手,很抱歉这个问题

1 个答案:

答案 0 :(得分:1)

如前所述,您可以使用CMake调整安装位置,只需使用CMAKE_INSTALL_PREFIX变量即可(请参阅this question的答案)。您可以将此变量设置为您可以访问的位置,因此最终会将软件安装在该位置。

您可以在调用CMAKE_INSTALL_PREFIX时在命令行上设置cmake变量,也可以在对project进行任何调用之前 之前在CMake文件本身中设置变量已经完成:

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