0

我正在尝试使用建议的 cmake 路线安装 trilinos 包。我对 cmake 没有任何经验,但是我找到了一个示例 bash 脚本。当我尝试执行此脚本时出现错误

CMake 错误:源目录“/home/USER/code/packages/trilinos_build/MPI_EXEC:FILEPATH=/usr/bin/pkg/mpiexec”不存在。指定 --help 使用,或按 CMake GUI 上的帮助按钮。

我检查了 cmake 文档,我很确定语法是正确的,我错过了什么?

#!/bin/bash

# Set this to the root of your Trilinos source directory.
TRILINOS_PATH=../trilinos_source
TRILINOS_BUILD_PATH=./

#
# You can invoke this shell script with additional command-line
# arguments.  They will be passed directly to CMake.
#
EXTRA_ARGS=$@

#
# Each invocation of CMake caches the values of build options in a
# CMakeCache.txt file.  If you run CMake again without deleting the
# CMakeCache.txt file, CMake won't notice any build options that have
# changed, because it found their original values in the cache file.
# Deleting the CMakeCache.txt file before invoking CMake will insure
# that CMake learns about any build options you may have changed.
# Experience will teach you when you may omit this step.
#
rm -f CMakeCache.txt

#
# Enable all primary stable Trilinos packages.
#
cmake \
  -D CMAKE_INSTALL_PREFIX:FILEPATH="${TRILINOS_BUILD_PATH}/mpi" \
  -D CMAKE_BUILD_TYPE:STRING=RELEASE \
  -D Trilinos_ENABLE_TESTS:BOOL=OFF \
  -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=OFF \
  -D TPL_ENABLE_MPI:BOOL=ON \
  -D MPI_EXEC:FILEPATH="/usr/bin/pkg/mpiexec" \


$EXTRA_ARGS \
$TRILINOS_PATH
4

1 回答 1

0

我对 cmake 有类似的问题,这是因为在最后一行和 $EXTRA_ARGS \ 之间输入了白色。只需删除空行,错误就会消失。

所以你的文件应该是这样的:

#!/bin/bash

# Set this to the root of your Trilinos source directory.
TRILINOS_PATH=../trilinos_source
TRILINOS_BUILD_PATH=./

#
# You can invoke this shell script with additional command-line
# arguments.  They will be passed directly to CMake.
#
EXTRA_ARGS=$@

#
# Each invocation of CMake caches the values of build options in a
# CMakeCache.txt file.  If you run CMake again without deleting the
# CMakeCache.txt file, CMake won't notice any build options that have
# changed, because it found their original values in the cache file.
# Deleting the CMakeCache.txt file before invoking CMake will insure
# that CMake learns about any build options you may have changed.
# Experience will teach you when you may omit this step.
#
rm -f CMakeCache.txt

#
# Enable all primary stable Trilinos packages.
#
cmake \
  -D CMAKE_INSTALL_PREFIX:FILEPATH="${TRILINOS_BUILD_PATH}/mpi" \
  -D CMAKE_BUILD_TYPE:STRING=RELEASE \
  -D Trilinos_ENABLE_TESTS:BOOL=OFF \
  -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=OFF \
  -D TPL_ENABLE_MPI:BOOL=ON \
  -D MPI_EXEC:FILEPATH="/usr/bin/pkg/mpiexec" \
$EXTRA_ARGS \
$TRILINOS_PATH

此外,如果您在 -D 选项之间用 # 注释任何行,也会显示相同的错误。在 cmake\ 之后,所有行必须是连续的。

希望它会有所帮助!

于 2017-11-24T07:37:13.593 回答