【发布时间】:2014-05-18 02:12:26
【问题描述】:
我有以下CMakeLists.txt:
cmake_minimum_required (VERSION 2.8.7)
project (Test)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(CURL REQUIRED)
find_package(PortAudio REQUIRED)
find_package(LibSndFile REQUIRED)
include_directories(src/audio src/web)
set(LIBS ${LIBS} ${LIBSNDFILE_LIBRARY} ${PORTAUDIO_LIBRARIES} ${CURL_LIBRARIES})
file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/src/*.c)
add_executable(Test ${sources})
target_link_libraries(Test ${LIBS})
这是我的文件夹结构:
Test/
├── .gitignore
├── README
├── CMakeLists.txt
├── src/
│ ├── audio/
│ │ └── ...
│ ├── web/
│ │ └── ...
│ └── ...
├── build/
└── cmake/
├── FindLibSndFile.cmake
└── FindPortaudio.cmake
当我在 Mac 上编译我的程序时,我进入build/ 目录并运行程序生成的cmake ..:
-- The C compiler identification is Clang 5.1.0
-- The CXX compiler identification is Clang 5.1.0
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found CURL: /usr/lib/libcurl.dylib (found version "7.30.0")
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.28")
-- checking for module 'portaudio-2.0'
-- found portaudio-2.0, version 19
-- Found LibSndFile: /usr/local/lib/libsndfile.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: Development/Test/build
一切都运行良好,花花公子。但是当我将源代码复制到我的 Raspberry Pi 并重复上述步骤时,它会向我吐出这个:
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found CURL: /usr/lib/arm-linux-gnueabihf/libcurl.so (found version "7.26.0")
CMake Error at CMakeLists.txt:7 (find_package):
By not providing "FindPortAudio.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"PortAudio", but CMake did not find one.
Could not find a package configuration file provided by "PortAudio" with
any of the following names:
PortAudioConfig.cmake
portaudio-config.cmake
Add the installation prefix of "PortAudio" to CMAKE_PREFIX_PATH or set
"PortAudio_DIR" to a directory containing one of the above files. If
"PortAudio" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
我不太清楚为什么它不起作用。有什么建议吗?
【问题讨论】:
标签: c linux compilation cmake cross-platform