首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >cmake认为变量是一个目录

cmake认为变量是一个目录
EN

Stack Overflow用户
提问于 2017-02-15 03:56:07
回答 1查看 142关注 0票数 0

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

源目录"/home/USER/code/packages/trilinos_build/MPI_EXEC:FILEPATH=/usr/bin/pkg/mpiexec“不存在CMake错误。指定--help了解用法,或按CMake图形用户界面上的help按钮。

我检查了cmake文档,我非常确定语法是正确的,我遗漏了什么?

代码语言:javascript
复制
#!/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
EN

回答 1

Stack Overflow用户

发布于 2017-11-24 15:37:14

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

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

代码语言:javascript
复制
#!/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\之后,所有行都必须是连续的。

希望这能有所帮助!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42235060

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档