Fix pkg-config overwriting find_package results
Jeffrey Pfau jeffrey@endrift.com
Sat, 25 Oct 2014 01:43:05 -0700
1 files changed,
11 insertions(+),
7 deletions(-)
jump to
M
CMakeLists.txt
→
CMakeLists.txt
@@ -31,12 +31,16 @@ if (NOT ${FEATURE_NAME})
return() endif() foreach(REQUIRE ${FEATURE_REQUIRES}) - find_package(${REQUIRE} QUIET) - pkg_search_module(${REQUIRE} ${REQUIRE}) - if (NOT ${REQUIRE}_FOUND) - message(WARNING "Requested module ${REQUIRE} missing for feature ${FEATURE_NAME}. Feature disabled.") - set(${FEATURE_NAME} OFF PARENT_SCOPE) - return() + if(NOT ${REQUIRE}_FOUND) + find_package(${REQUIRE} QUIET) + if(NOT ${REQUIRE}_FOUND) + pkg_search_module(${REQUIRE} ${REQUIRE}) + if (NOT ${REQUIRE}_FOUND) + message(WARNING "Requested module ${REQUIRE} missing for feature ${FEATURE_NAME}. Feature disabled.") + set(${FEATURE_NAME} OFF PARENT_SCOPE) + return() + endif() + endif() endif() string(TOUPPER ${REQUIRE} UREQUIRE) set(${UREQUIRE}_CFLAGS_OTHER ${${REQUIRE}_CFLAGS_OTHER} PARENT_SCOPE)@@ -78,7 +82,7 @@
# Feature dependencies find_feature(USE_CLI_DEBUGGER "libedit") find_feature(USE_FFMPEG "libavcodec;libavformat;libavutil") -find_feature(USE_PNG "PNG;ZLIB") +find_feature(USE_PNG "ZLIB;PNG") find_feature(USE_LIBZIP "libzip") include(CheckFunctionExists)