From fe1d0579ec820e46e36a28e80c0cad083299899b Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Sat, 12 Nov 2016 15:03:45 +0100 Subject: [PATCH] fix(build): Handle empty list of bat/adp names --- examples/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a9928b01..c5df1e67 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -33,8 +33,17 @@ string(REGEX REPLACE /%adapter%.* "" PATH_ADP ${SETTING_PATH_ADAPTER_STATUS}) file(GLOB BAT_LIST RELATIVE ${PATH_BAT} ${PATH_ADP}/B*) file(GLOB ADP_LIST RELATIVE ${PATH_ADP} ${PATH_ADP}/A*) -list(GET BAT_LIST 0 BATTERY) -list(GET ADP_LIST 0 ADAPTER) +if(BAT_LIST) + list(GET BAT_LIST 0 BATTERY) +else() + set(BATTERY BAT0) +endif() + +if(ADP_LIST) + list(GET ADP_LIST 0 ADAPTER) +else() + set(ADAPTER ADP1) +endif() # }}} # Configure and install {{{