2014-06-07 4 views
2

첫 번째 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) 

을 내 터미널 출력에 의해 같이 cmake/모듈 폴더에 (다운로드)를 FindGSL.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". 

누구든지 내가 뭘 잘못 지적 할 수 있을까요?

+0

나를 위해 잘 작동합니다. '/ Users/adam/repos/ctmc/cmake/Modules/FindGSL.cmake' 파일이 있는지 확인 하시겠습니까? –

+0

이상한, 네, 파인더에서 확인하고 커맨드 라인에서 파일이나 설정에 필요한 환경 변수에 대한 사용 권한인지 궁금 해서요! – madawilliams

+0

나는 리눅스 박스에서도 똑같은 오류를 시도했다. FindGSL.cmake 파일에 오류가있는 경우이 메시지가 표시됩니까 – madawilliams

답변

1

cmake/Modules 디렉토리 권한을 확인하십시오. 당신은 당신이 그것에 전체 경로이 경우 파일을 읽을 수 있도록 디렉토리 execute 권한이없는,하지만 당신은 그것을 찾을 수 없습니다 : 다시

> ls cmake/Modules/FindMy.cmake 
cmake/Modules/FindMy.cmake 
> cat CMakeLists.txt 
cmake_minimum_required(VERSION 3.0) 
project(Foo) 
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") 
find_package(My REQUIRED) 
> cmake -H. -B_builds 
... OK 

x -permission

없이
> chmod -x cmake/Modules/ 
> rm -rf _builds/ 
> cmake -H. -B_builds 
... 
CMake Error at CMakeLists.txt:5 (find_package): 
    By not providing "FindMy.cmake" in CMAKE_MODULE_PATH this project has asked 
    CMake to find a package configuration file provided by "My", but CMake did 
    not find one. 
+0

위대한 !! 그게 내가 어리석은 짓을해야한다는 것을 알았던 도움을 얻은 건 그 환호성을 키웠다. – madawilliams

관련 문제