Merge pull request #4670 from endrift/fix-freebsd-config-testing

CMake: Search /usr/local paths on BSD
This commit is contained in:
Matthew Parlane 2017-01-17 21:51:28 +13:00 committed by GitHub
commit 59906cb292
1 changed files with 17 additions and 0 deletions

View File

@ -352,6 +352,23 @@ if(UNIX)
endif(LINUX_LOCAL_DEV)
endif(UNIX)
# BSDs put packages in /usr/local instead of /usr, so we need to
# force CMake to look in those directories by default, too.
# All commands and submodule commands also need to see these
# changes, so just setting them in the project scope via
# include_directories and link_directories is not sufficient
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD")
# CMake before 3.2 does not respect CMAKE_EXE_LINKER_FLAGS in
# try_compile, which can cause our compilation check functions
# to spuriously fail
if(POLICY CMP0056)
cmake_policy(SET CMP0056 NEW)
endif()
set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};/usr/local")
set(CMAKE_REQUIRED_INCLUDES "/usr/local/include")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
endif()
# Dolphin requires threads.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.