First a snippet taken from FindALSA.cmake from cmake-2.8.7:
find_path(ALSA_INCLUDE_DIR NAMES asoundlib.h
          PATH_SUFFIXES alsa
          DOC "The ALSA (asound) include directory"
)

If I understand correctly how find_path and PATH_SUFFIXES work, then it means
that if asoundlib.h has a full path of /some/dir/alsa/asoundlib.h, then
ALSA_INCLUDE_DIR will get a value of /some/dir/alsa.

I perceive this as a problem because typically (always?) the code that uses ALSA
includes <alsa/asoundlib.h> and not <asoundlib.h>.  And thus there would be a
mismatch between -I/some/dir/alsa and #include <alsa/asoundlib.h>.

Of course, it seems that the problem is frequently just masked, especially on
GNU/Linux systems, where /some/dir is actually /usr/include and this directory
has a magic property of being a system include directory.  So alsa/asoundlib.h
gets resolved relative to the implicit /usr/include and not to the explicit
/usr/include/alsa.

On other systems where asoundlib.h may reside in e.g.
/usr/local/include/alsa/asoundlib.h a compiler won't be able to find
alsa/asoundlib.h because /usr/local/include doesn't have any magic properties.

To summarize, if the C code actually includes alsa/asoundlib.h, then wouldn't it
be appropriate to use exactly the same path, alsa/asoundlib.h, with find_path
like this:
find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
          DOC "The ALSA (asound) include directory"
)
?

What do you think?
Thank you!
-- 
Andriy Gapon
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to