2

我正在尝试使用 CMake 的ExternalProject_Add命令在 Ubuntu 18.04 上使用 cmake 3.15.7 构建一个 Autotools 项目。这是我正在使用的命令:

set(THIRD_PARTY_DIRS ${CMAKE_SOURCE_DIR}/third_party)
set(RAPTOR_SOURCE_DIR ${THIRD_PARTY_DIRS}/raptor2-2.0.15)
set(RAPTOR_BINARY_DIR ${RAPTOR_SOURCE_DIR}/build)
set(RAPTOR_INSTALL_PREFIX ${RAPTOR_SOURCE_DIR}/install_dir)

ExternalProject_Add(raptor
        SOURCE_DIR ${RAPTOR_SOURCE_DIR} # exists in the third party directory
        BINARY_DIR ${RAPTOR_BINARY_DIR}
        MKDIR ${RAPTOR_INSTALL_PREFIX}

        USES_TERMINAL_CONFIGURE 1 # Added these in to try them, they do not seem to do anything
        USES_TERMINAL_BUILD 1
        USES_TERMINAL_INSTALL 1

        #note: this command has been manually tested outside of cmake and works perfectly
        CONFIGURE_COMMAND "${RAPTOR_SOURCE_DIR}/autogen.sh --prefix=${RAPTOR_INSTALL_PREFIX}" 
        BUILD_COMMAND "make"
        INSTALL_COMMAND "make install"
        )

导致错误:

/bin/sh: 1: /mnt/d/libsemsim/third_party/raptor2-2.0.15/autogen.sh --prefix=/mnt/d/libsemsim/third_party/raptor2-2.0.15/install_dir: not found
CMakeFiles/raptor.dir/build.make:106: recipe for target 'raptor-prefix/src/raptor-stamp/raptor-configure' failed
make[3]: *** [raptor-prefix/src/raptor-stamp/raptor-configure] Error 127
CMakeFiles/Makefile2:241: recipe for target 'CMakeFiles/raptor.dir/all' failed
make[2]: *** [CMakeFiles/raptor.dir/all] Error 2
CMakeFiles/Makefile2:253: recipe for target 'CMakeFiles/raptor.dir/rule' failed
make[1]: *** [CMakeFiles/raptor.dir/rule] Error 2
Makefile:183: recipe for target 'raptor' failed
make: *** [raptor] Error 2

该命令的变体


ExternalProject_Add(raptor
        SOURCE_DIR ${RAPTOR_SOURCE_DIR} 
        BINARY_DIR ${RAPTOR_BINARY_DIR}

        USES_TERMINAL_CONFIGURE 1 
        USES_TERMINAL_BUILD 1
        USES_TERMINAL_INSTALL 1
        CONFIGURE_COMMAND "${RAPTOR_SOURCE_DIR}/autogen.sh"  
        BUILD_COMMAND "make"
        INSTALL_COMMAND "make install"
        )

即不提供前缀路径,导致 cmake 挂起并且什么也不做。

谁能建议我在这里做错了什么?

如果有帮助,这里有一些附加信息

(base) ciaran@DESKTOP-K0APGUV:/mnt/d/libsemsim/third_party/raptor2-2.0.15$ pwd
/mnt/d/libsemsim/third_party/raptor2-2.0.15
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/libsemsim/third_party/raptor2-2.0.15$ tree -L 1
.
├── AUTHORS
├── CMakeLists.txt
├── COPYING
├── COPYING.LIB
├── INSTALL
├── INSTALL.html
├── LICENSE-2.0.txt
├── LICENSE.html
├── LICENSE.txt
├── Makefile
├── Makefile.am
├── Makefile.in
├── NEWS
├── NEWS.html
├── NOTICE
├── README
├── README-cmake.md
├── README.html
├── RELEASE.html
├── UPGRADING.html
├── aclocal.m4
├── autogen.sh
├── autom4te.cache
├── build
├── config.log
├── config.status
├── configure
├── configure.ac
├── data
├── docs
├── examples
├── gtk-doc.make
├── install.ubuntu
├── install_dir
├── librdfa
├── libtool
├── mkinstalldirs
├── raptor2.pc
├── raptor2.pc.in
├── raptor2.rdf
├── raptor2.rdf.in
├── raptor2.spec
├── raptor2.spec.in
├── scripts
├── src
├── tests
└── utils

编辑

正如评论中所建议的,我尝试将调用中的命令和参数分开CONFIGURE_COMMAND

set(prefix "${RAPTOR_INSTALL_PREFIX}")
ExternalProject_Add(raptor
        SOURCE_DIR ${RAPTOR_SOURCE_DIR}
        BINARY_DIR ${RAPTOR_BINARY_DIR}
        MKDIR ${RAPTOR_INSTALL_PREFIX}

        USES_TERMINAL_CONFIGURE 1
        USES_TERMINAL_BUILD 1
        USES_TERMINAL_INSTALL 1
        CONFIGURE_COMMAND "${RAPTOR_SOURCE_DIR}/autogen.sh" "--prefix=${RAPTOR_INSTALL_PREFIX}"
        BUILD_COMMAND "make"
        INSTALL_COMMAND "make install"
        )

但我仍然遇到“挂起”问题:

[ 12%] Creating directories for 'raptor'
[ 25%] No download step for 'raptor'
[ 50%] No patch step for 'raptor'
[ 50%] No update step for 'raptor'
[ 62%] Performing configure step for 'raptor'

就这样一个多小时了。

4

0 回答 0