Hello. On FreeBSD everything, that distributes with system goes to /usr
(i mean includes go to /usr/includes and libs to /usr/lib) and all 3d
party stuff goes to /usr/local.<br><div class="gmail_quote">And the
compiler is intentionally set to look only in /usr/include. The same is
for linker - it's looking for libs only in /usr/lib by default. So, if
user want to use some 3d-party library, he should add
-I/usr/local/include and -L/usr/local/lib to build command.<br>
<br>Now, i'm using find_library() and find_path() to locate 3d-party library in such way:<br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">
find_path(FFI_INCLUDE_PATH ffi.h PATHS ${USER_DEFINED_INCLUDE_DIR})<br>find_library(FFI_LIBRARY_PATH ffi PATHS ${USER_DEFINED_LIB_DIR})<br></blockquote><div>I'm
expecting that search will not succeed until i supply CMake with
additional directories to search. But it's succeeds because
CMAKE_SYSTEM_PREFIX_PATH from Modules/Platform/UnixPaths.cmake is set to "/usr;/usr/local;/". And this file is included by Modules/Platform/FreeBSD.cmake.<br>
<br>Later i'm doing:<br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">if(${USER_DEFINED_INCLUDE_DIR})<br> include_directories(${FFI_INCLUDE_DIR})<br>
endif()<br></blockquote><br>On FreeBSD it leads to "No such file or
directory: ffi.h" error. So here is the question: Is this a CMake bug?
Or it's wrong to assume that headers and library are in compiler's
default search path if CMake finds them without user's help?</div>
</div>