Explorar el Código

Allow defining PICOWOTA_WIFI_AP in the environment

This aligns the behavior of the build variables, providing a helper function to do the job.
Tomi hace 2 años
padre
commit
aa6093b094
Se han modificado 1 ficheros con 15 adiciones y 8 borrados
  1. 15
    8
      CMakeLists.txt

+ 15
- 8
CMakeLists.txt Ver fichero

@@ -73,15 +73,22 @@ target_link_libraries(picowota
73 73
 	picowota_reboot
74 74
 )
75 75
 
76
-if (DEFINED ENV{PICOWOTA_WIFI_SSID} AND (NOT PICOWOTA_WIFI_SSID))
77
-	set(PICOWOTA_WIFI_SSID $ENV{PICOWOTA_WIFI_SSID})
78
-	message("Using PICOWOTA_WIFI_SSID from environment ('${PICOWOTA_WIFI_SSID}')")
79
-endif ()
76
+# Retrieves build variables from the environment if present
77
+function(picowota_retrieve_variable name hidden)
78
+	if (DEFINED ENV{${name}} AND (NOT ${name}))
79
+		set(${name} $ENV{${name}} PARENT_SCOPE)
80
+		if (hidden)
81
+			set(log_value "hidden")
82
+		else()
83
+			set(log_value "'$ENV{${name}}'")
84
+		endif()
85
+		message("Using ${name} from environment (${log_value})")
86
+	endif()
87
+endfunction()
80 88
 
81
-if (DEFINED ENV{PICOWOTA_WIFI_PASS} AND (NOT PICOWOTA_WIFI_PASS))
82
-	set(PICOWOTA_WIFI_PASS $ENV{PICOWOTA_WIFI_PASS})
83
-	message("Using PICOWOTA_WIFI_PASS from environment (hidden)")
84
-endif ()
89
+picowota_retrieve_variable(PICOWOTA_WIFI_SSID false)
90
+picowota_retrieve_variable(PICOWOTA_WIFI_PASS true)
91
+picowota_retrieve_variable(PICOWOTA_WIFI_AP false)
85 92
 
86 93
 if ((NOT PICOWOTA_WIFI_SSID) OR (NOT PICOWOTA_WIFI_PASS))
87 94
         message(FATAL_ERROR

Loading…
Cancelar
Guardar