Optimize example

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2018-01-01 09:37:59 +08:00
parent 78f060779e
commit 4fc1826889
3 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@
# LIBUBOX_INCLUDE_DIR - The libubox include directories # LIBUBOX_INCLUDE_DIR - The libubox include directories
# LIBUBOX_LIBRARY - The libraries needed to use libubox # LIBUBOX_LIBRARY - The libraries needed to use libubox
find_path(LIBUBOX_INCLUDE_DIR uloop.h PATH_SUFFIXES libubox) find_path(LIBUBOX_INCLUDE_DIR libubox)
find_library(LIBUBOX_LIBRARY ubox PATH_SUFFIXES lib64) find_library(LIBUBOX_LIBRARY ubox PATH_SUFFIXES lib64)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)

View File

@ -4,13 +4,13 @@
# LIBUHTTPD_INCLUDE_DIR - The libuhttpd include directories # LIBUHTTPD_INCLUDE_DIR - The libuhttpd include directories
# LIBUHTTPD_LIBRARY - The libraries needed to use libuhttpd # LIBUHTTPD_LIBRARY - The libraries needed to use libuhttpd
find_path(LIBUHTTPD_INCLUDE_DIR uhttpd.h PATH_SUFFIXES uhttpd) find_path(LIBUHTTPD_INCLUDE_DIR uhttpd)
find_library(LIBUHTTPD_LIBRARY uhttpd PATH_SUFFIXES lib64) find_library(LIBUHTTPD_LIBRARY uhttpd PATH_SUFFIXES lib64)
if(LIBUHTTPD_INCLUDE_DIR) if(LIBUHTTPD_INCLUDE_DIR)
file(STRINGS "${LIBUHTTPD_INCLUDE_DIR}/uhttpd.h" file(STRINGS "${LIBUHTTPD_INCLUDE_DIR}/uhttpd/uhttpd.h"
LIBUHTTPD_VERSION_MAJOR REGEX "^#define[ \t]+UHTTPD_VERSION_MAJOR[ \t]+[0-9]+") LIBUHTTPD_VERSION_MAJOR REGEX "^#define[ \t]+UHTTPD_VERSION_MAJOR[ \t]+[0-9]+")
file(STRINGS "${LIBUHTTPD_INCLUDE_DIR}/uhttpd.h" file(STRINGS "${LIBUHTTPD_INCLUDE_DIR}/uhttpd/uhttpd.h"
LIBUHTTPD_VERSION_MINOR REGEX "^#define[ \t]+UHTTPD_VERSION_MINOR[ \t]+[0-9]+") LIBUHTTPD_VERSION_MINOR REGEX "^#define[ \t]+UHTTPD_VERSION_MINOR[ \t]+[0-9]+")
string(REGEX REPLACE "[^0-9]+" "" LIBUHTTPD_VERSION_MAJOR "${LIBUHTTPD_VERSION_MAJOR}") string(REGEX REPLACE "[^0-9]+" "" LIBUHTTPD_VERSION_MAJOR "${LIBUHTTPD_VERSION_MAJOR}")
string(REGEX REPLACE "[^0-9]+" "" LIBUHTTPD_VERSION_MINOR "${LIBUHTTPD_VERSION_MINOR}") string(REGEX REPLACE "[^0-9]+" "" LIBUHTTPD_VERSION_MINOR "${LIBUHTTPD_VERSION_MINOR}")

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <uhttpd.h> #include <uhttpd/uhttpd.h>
#define port "8000" #define port "8000"
@ -50,7 +50,7 @@ int main(int argc, char **argv)
uh_log_debug("Listen on: *:%s", port); uh_log_debug("Listen on: *:%s", port);
#if (UHTTPD_SSL_SUPPORT) #if (UHTTPD_SSL_SUPPORT)
if (srv->ssl_init(srv, "server-key.pem", "server-cert.pem") < 0) if (srv->ssl_init(srv, "/etc/wifidog/wifidog.key", "/etc/wifidog/wifidog.crt") < 0)
goto done; goto done;
#endif #endif