Included directories not being found when using CMake on Windows
This project compiles find when run under Linux, but fails when I try to make a VC solution for Windows. The error is:
e:\src\audio\audio.h(5): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
I am including the library that contains portaudio.h
as so:
find_package(portaudio REQUIRED)
Which is found using the file Findportaudio.cmake
, which looks like it's pointing to the right directory:
include(LibFindMacros)
find_path(Portaudio_INCLUDE_DIR NAMES portaudio.h PATHS ../src/extern/portaudio/include)
find_library(Portaudio_LIBRARY NAMES portaudio PATHS ../src/extern/portaudio/lib)
set(Portaudio_PROCESS_INCLUDES Pulseaudio_INCLUDE_DIR)
set(Portaudio_PROCESS_LIBS Pulseaudio_LIBRARY)
libfind_process(开发者_如何学编程Portaudio)
This all works just fine when I run it under Linux, but when I generate my make files it does not. I get the error mentioned above a bunch of times. The project's properties only lists %(AdditionalIncludeDirectories)
for the Additional Include Directories (under C/C++ > General) but I don't know where that gets set or what it's getting set to.
(If I've omitted any relevant information let me know and I'll amend my question).
Normally I do the following for most packages:
FIND_PACKAGE( GDCM REQUIRED )
INCLUDE_DIRECTORIES( ${GDCM_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${GDCM_LIBRARY_DIRS} )
In your case it looks like
FIND_PACKAGE( portaudio REQUIRED )
INCLUDE_DIRECTORIES( ${Portaudio_INCLUDE_DIR} )
LINK_DIRECTORIES( ${Portaudio_LIBRARY} )
will work.
I believe your original command works on linux because it is picking up the standard include and library folders while on windows there is no standard.
精彩评论