Архівний
1
0
This repo is archived. You can view files and clone it, but cannot push or open issues or pull requests.
controller/Lib/CMake/FindDFUSuffix.cmake
Jacob Alexander a959011faa Adding dfu-suffix signing support to build system
- If dfu-suffix is not found, a warning is given and the binary is not signed
- Unsigned binaries are still ok with the latest version of dfu-util
2015-03-02 01:58:53 -08:00

41 рядки
1.4 KiB
CMake

# The module defines the following variables:
# DFU_SUFFIX_EXECUTABLE - path to ctags command line client
# DFU_SUFFIX_FOUND - true if the command line client was found
# DFU_SUFFIX_VERSION_STRING - the version of dfu-suffix found (since CMake 2.8.8)
# Example usage:
# find_package( DFUSuffix )
# if( DFU_SUFFIX_FOUND )
# message("ctags found: ${DFU_SUFFIX_EXECUTABLE}")
# endif()
find_program ( DFU_SUFFIX_EXECUTABLE
NAMES dfu-suffix
DOC "dfu-suffix executable"
)
mark_as_advanced ( DFU_SUFFIX_EXECUTABLE )
if ( DFU_SUFFIX_EXECUTABLE )
execute_process ( COMMAND ${DFU_SUFFIX_EXECUTABLE} --version
OUTPUT_VARIABLE dfu_suffix_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if ( dfu_suffix_version MATCHES "^dfu-suffix \\(dfu-util\\)" )
string ( REPLACE "\n" "" DFU_SUFFIX_VERSION_STRING ${dfu_suffix_version} )
string ( REPLACE "dfu-suffix (dfu-util) " "" DFU_SUFFIX_VERSION_STRING ${DFU_SUFFIX_VERSION_STRING} )
string ( REGEX REPLACE "Copyright .*$" "" DFU_SUFFIX_VERSION_STRING ${DFU_SUFFIX_VERSION_STRING} )
endif ()
unset ( dfu_suffix_version )
endif ()
# Handle the QUIETLY and REQUIRED arguments and set DFU_SUFFIX_FOUND to TRUE if
# all listed variables are TRUE
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args ( DFU_SUFFIX
REQUIRED_VARS DFU_SUFFIX_EXECUTABLE
VERSION_VAR DFU_SUFFIX_VERSION_STRING
)