2017-02-14 54 views
0

我正在尝试使用建议的cmake路由安装trilinos软件包。我没有使用cmake的经验,但是我找到了一个示例bash脚本。当我尝试执行此脚本时,出现错误cmake认为变量是一个目录

CMake错误:源目录“/ home/USER/code/packages/trilinos_build/MPI_EXEC:FILEPATH =/usr/bin/pkg/mpiexec”不存在。 指定 - 帮助使用,或按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. 
# 
[email protected] 

# 
# 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 
+0

我不确定,但似乎'$ EXTRA_ARGS'和其他参数没有传递给cmake:它们由前几行参数分隔几行,行尾的'\'只在下一行提供继续线。顺便说一句,你可以通过直接调用适当的参数来调试'cmake'的调用,而不是使用脚本。 – Tsyvarev

+0

就是这样,太多的空白。谢谢。 – roro

回答

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. 
# 
[email protected] 

# 
# 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之后\所有行必须连续。

希望它能帮到你!