Reputation: 8247
I have the following 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})
Here is what my folder structure looks like:
Test/
├── .gitignore
├── README
├── CMakeLists.txt
├── src/
│ ├── audio/
│ │ └── ...
│ ├── web/
│ │ └── ...
│ └── ...
├── build/
└── cmake/
├── FindLibSndFile.cmake
└── FindPortaudio.cmake
When I go to compile my program on a Mac, I go into the build/
directory and run cmake ..
, to which the program generates:
-- 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
Everything runs fine and dandy. But when I copy the source over to my Raspberry Pi and repeat the above steps, it spits this out at me:
-- 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!
I'm not too sure why it isn't working. Any suggestions?
Upvotes: 1
Views: 1079
Reputation: 121
Macs are case insensitive while other operating systems are generally case sensitive. To solve this problem, either change the file name of FindPortaudio.cmake
--> FindPortAudio.cmake
(notice the capital A
in audio). Or in the CMakeLists.txt
file, change the A
in audio to a lowercase character. i.e., change
find_package(PortAudio REQUIRED)
to
find_package(Portaudio REQUIRED)
Upvotes: 3