cmake: Fix warnings and normalize variables/errors

As of 3.17 using find_package_handle_standard_args checks that the name
of the FindXXX file and the first argument are the same case.

Some modules used non-standard variables or the old singular variables
instead of plurals. This normalizes variable usage to the new-style.

Some CMakeLists.txt did custom error checking instead of propagating
find_package errors. These were changes to call find_package with
REQUIRED or without QUIET where needed and shortens the custom status
messages. This helps users who want to enable that functionality see
what precisely wasnt found.
This commit is contained in:
Kurt Kartaltepe
2020-04-03 20:56:48 -07:00
parent e822b47427
commit d928bfd1ea
12 changed files with 63 additions and 83 deletions

View File

@@ -5,22 +5,21 @@ set_property(CACHE WITH_RTMPS PROPERTY STRINGS AUTO ON OFF)
option(STATIC_MBEDTLS "Statically link mbedTLS into binary" OFF)
if (WITH_RTMPS OR (WITH_RTMPS STREQUAL "AUTO"))
find_package(MbedTLS QUIET)
find_package(ZLIB QUIET)
if (WITH_RTMPS STREQUAL "AUTO")
find_package(MbedTLS)
find_package(ZLIB)
if (NOT MBEDTLS_FOUND OR NOT ZLIB_FOUND)
set(WITH_RTMPS "OFF")
message(WARNING "mbedTLS or zlib was not found, RTMPS will be auto-disabled")
endif()
endif()
if (LIBMBEDTLS_FOUND AND ZLIB_FOUND)
if (WITH_RTMPS)
find_package(MbedTLS REQUIRED)
find_package(ZLIB REQUIRED)
add_definitions(-DCRYPTO -DUSE_MBEDTLS)
include_directories(${LIBMBEDTLS_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS})
include_directories(${MBEDTLS_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS})
else()
if(WITH_RTMPS STREQUAL "AUTO")
message(WARNING "mbedTLS was not found, RTMPS will be auto-disabled")
elseif (WITH_RTMPS)
message(FATAL_ERROR "RTMPS enabled by user, but mbedTLS was not found")
endif()
unset(LIBMBEDTLS_LIBRARIES)
unset(ZLIB_LIBRARIES)
add_definitions(-DNO_CRYPTO)
endif()
@@ -172,7 +171,7 @@ add_library(obs-outputs MODULE
${obs-outputs_librtmp_HEADERS})
target_link_libraries(obs-outputs
libobs
${LIBMBEDTLS_LIBRARIES}
${MBEDTLS_LIBRARIES}
${ZLIB_LIBRARIES}
${ftl_IMPORTS}
${obs-outputs_PLATFORM_DEPS})