只是試圖創建我的第一個cmake項目。我有一個非常簡單的設置,但似乎無法讓find_package工作。我在Mac OS X 10.9.3上,並從dmg軟件包(cmake 2.8.12.2版)中安裝了cmake。我已經創建了一個非常簡單的CMakeLists.txt如下:cmake find_package無法在Mac OS X上工作
cmake_minimum_required (VERSION 2.8)
project (Tutorial)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 「${CMAKE_SOURCE_DIR}/cmake/Modules」)
message(STATUS ${CMAKE_MODULE_PATH})
FIND_PACKAGE(GSL REQUIRED)
add_executable(Tutorial src/main.cpp)
,並放置在FindGSL.cmake文件中的cmake /模塊的文件夾(下載)如由我的終端輸出:
bash-3.2$ ls cmake/Modules/
FindGSL.cmake
然後,我從cmake得到以下輸出:
bash-3.2$ cmake ../
-- 「/Users/adam/repos/ctmc/cmake/Modules」
CMake Error at CMakeLists.txt:6 (FIND_PACKAGE):
By not providing "FindGSL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "GSL", but
CMake did not find one.
Could not find a package configuration file provided by "GSL" with any of
the following names:
GSLConfig.cmake
gsl-config.cmake
Add the installation prefix of "GSL" to CMAKE_PREFIX_PATH or set "GSL_DIR"
to a directory containing one of the above files. If "GSL" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
See also "/Users/adam/repos/ctmc/build/CMakeFiles/CMakeOutput.log".
任何人都可以指出我做錯了什麼?
適合我。你確定存在'/ Users/adam/repos/ctmc/cmake/Modules/FindGSL.cmake'文件嗎? –
奇怪的是,在發現者和命令行檢查似乎沒有找到它,想知道它是權限的文件或我需要設置一些環境變量!我將在另一臺計算機上嘗試返回 – madawilliams
我也在Linux機器上嘗試過,並得到相同的錯誤。如果FindGSL.cmake文件中存在錯誤,它會提供此消息 – madawilliams