Files @ r26005:fa9fad1bd9d6
Branch filter:

Location: cpp/openttd-patchpack/source/cmake/LinkPackage.cmake

Patric Stout
Add: [Network] Keep the refresh button in lowered state while refreshing (#9600)

This gives user visual feedback that the refresh is still pending, and
prevents people from clicking again and again thinking nothing is
happening. This is especially true for connections that fall back to
TURN, as that takes a few seconds to kick in.

Additionally, prevent clicking on the button again while a refresh
is pending. This is only delaying a successful result.
function(link_package NAME)
    cmake_parse_arguments(LP "ENCOURAGED" "TARGET" "" ${ARGN})

    if(${NAME}_FOUND)
        string(TOUPPER "${NAME}" UCNAME)
        add_definitions(-DWITH_${UCNAME})
        # Some libraries' cmake packages (looking at you, SDL2) leave trailing whitespace in the link commands,
        # which (later) cmake considers to be an error. Work around this with by stripping the incoming string.
        if(LP_TARGET AND TARGET ${LP_TARGET})
            string(STRIP "${LP_TARGET}" LP_TARGET)
            target_link_libraries(openttd ${LP_TARGET})
            message(STATUS "${NAME} found -- -DWITH_${UCNAME} -- ${LP_TARGET}")
        else()
            string(STRIP "${${NAME}_LIBRARY}" ${NAME}_LIBRARY)
            string(STRIP "${${NAME}_LIBRARIES}" ${NAME}_LIBRARIES)
            include_directories(${${NAME}_INCLUDE_DIRS} ${${NAME}_INCLUDE_DIR})
            target_link_libraries(openttd ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY})
            message(STATUS "${NAME} found -- -DWITH_${UCNAME} -- ${${NAME}_INCLUDE_DIRS} ${${NAME}_INCLUDE_DIR} -- ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY}")
        endif()
    elseif(LP_ENCOURAGED)
        message(WARNING "${NAME} not found; compiling OpenTTD without ${NAME} is strongly disencouraged")
    endif()
endfunction()