2017-02-14 87 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之後\所有行必須連續。

希望它能幫到你!