Fix pkg-config overwriting find_package results

This commit is contained in:
Jeffrey Pfau 2014-10-25 01:43:05 -07:00
parent a265cf45a9
commit c7a1894a99
1 changed files with 11 additions and 7 deletions

View File

@ -31,12 +31,16 @@ function(find_feature FEATURE_NAME FEATURE_REQUIRES)
return() return()
endif() endif()
foreach(REQUIRE ${FEATURE_REQUIRES}) foreach(REQUIRE ${FEATURE_REQUIRES})
find_package(${REQUIRE} QUIET) if(NOT ${REQUIRE}_FOUND)
pkg_search_module(${REQUIRE} ${REQUIRE}) find_package(${REQUIRE} QUIET)
if (NOT ${REQUIRE}_FOUND) if(NOT ${REQUIRE}_FOUND)
message(WARNING "Requested module ${REQUIRE} missing for feature ${FEATURE_NAME}. Feature disabled.") pkg_search_module(${REQUIRE} ${REQUIRE})
set(${FEATURE_NAME} OFF PARENT_SCOPE) if (NOT ${REQUIRE}_FOUND)
return() message(WARNING "Requested module ${REQUIRE} missing for feature ${FEATURE_NAME}. Feature disabled.")
set(${FEATURE_NAME} OFF PARENT_SCOPE)
return()
endif()
endif()
endif() endif()
string(TOUPPER ${REQUIRE} UREQUIRE) string(TOUPPER ${REQUIRE} UREQUIRE)
set(${UREQUIRE}_CFLAGS_OTHER ${${REQUIRE}_CFLAGS_OTHER} PARENT_SCOPE) set(${UREQUIRE}_CFLAGS_OTHER ${${REQUIRE}_CFLAGS_OTHER} PARENT_SCOPE)
@ -78,7 +82,7 @@ add_definitions(-DBINARY_NAME="${BINARY_NAME}" -DPROJECT_NAME="${PROJECT_NAME}"
# Feature dependencies # Feature dependencies
find_feature(USE_CLI_DEBUGGER "libedit") find_feature(USE_CLI_DEBUGGER "libedit")
find_feature(USE_FFMPEG "libavcodec;libavformat;libavutil") find_feature(USE_FFMPEG "libavcodec;libavformat;libavutil")
find_feature(USE_PNG "PNG;ZLIB") find_feature(USE_PNG "ZLIB;PNG")
find_feature(USE_LIBZIP "libzip") find_feature(USE_LIBZIP "libzip")
include(CheckFunctionExists) include(CheckFunctionExists)