diff --git a/CMakeLists.txt b/CMakeLists.txt index 71b57f11..f8ea2189 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,9 @@ set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set (LWIP_DEFINITIONS LWIP_DEBUG=1) -if (${CMAKE_SYSTEM_NAME} STREQUAL Windows) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") add_subdirectory(${LWIP_DIR}/contrib/ports/win32/example_app) -elseif(${CMAKE_SYSTEM_NAME} STREQUAL Linux OR ${CMAKE_SYSTEM_NAME} STREQUAL Darwin) +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") add_subdirectory(${LWIP_DIR}/contrib/ports/unix/example_app) else() message(WARNING "Host ${CMAKE_SYSTEM_NAME} is not supported to build example_app") diff --git a/contrib/ports/CMakeCommon.cmake b/contrib/ports/CMakeCommon.cmake index da80512b..72deb376 100644 --- a/contrib/ports/CMakeCommon.cmake +++ b/contrib/ports/CMakeCommon.cmake @@ -64,7 +64,7 @@ if (NOT LWIP_HAVE_MBEDTLS) ) endif() -if(CMAKE_C_COMPILER_ID STREQUAL GNU) +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") list(APPEND LWIP_COMPILER_FLAGS_GNU_CLANG -Wlogical-op -Wtrampolines @@ -92,7 +92,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL GNU) set(LWIP_COMPILER_FLAGS ${LWIP_COMPILER_FLAGS_GNU_CLANG}) endif() -if(CMAKE_C_COMPILER_ID STREQUAL Clang) +if(CMAKE_C_COMPILER_ID STREQUAL "Clang") list(APPEND LWIP_COMPILER_FLAGS_GNU_CLANG -Wdocumentation -Wno-documentation-deprecated-sync @@ -110,6 +110,6 @@ if(CMAKE_C_COMPILER_ID STREQUAL Clang) set(LWIP_COMPILER_FLAGS ${LWIP_COMPILER_FLAGS_GNU_CLANG}) endif() -if(CMAKE_C_COMPILER_ID STREQUAL MSVC) - # TODO +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + set(LWIP_COMPILER_FLAGS /Wall /WX) endif() diff --git a/contrib/ports/unix/Filelists.cmake b/contrib/ports/unix/Filelists.cmake index bbdf5079..84bfdedf 100644 --- a/contrib/ports/unix/Filelists.cmake +++ b/contrib/ports/unix/Filelists.cmake @@ -30,14 +30,14 @@ target_compile_options(lwipcontribportunix PRIVATE ${LWIP_COMPILER_FLAGS}) target_compile_definitions(lwipcontribportunix PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) target_link_libraries(lwipcontribportunix PUBLIC ${LWIP_MBEDTLS_LINK_LIBRARIES}) -if (CMAKE_SYSTEM_NAME STREQUAL Linux) +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") find_library(LIBUTIL util) find_library(LIBPTHREAD pthread) find_library(LIBRT rt) target_link_libraries(lwipcontribportunix PUBLIC ${LIBUTIL} ${LIBPTHREAD} ${LIBRT}) endif() -if (CMAKE_SYSTEM_NAME STREQUAL Darwin) +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") # Darwin doesn't have pthreads or POSIX real-time extensions libs find_library(LIBUTIL util) target_link_libraries(lwipcontribportunix PUBLIC ${LIBUTIL}) diff --git a/contrib/ports/unix/check/CMakeLists.txt b/contrib/ports/unix/check/CMakeLists.txt index 3ad7016f..54f3d202 100644 --- a/contrib/ports/unix/check/CMakeLists.txt +++ b/contrib/ports/unix/check/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8) project(lwipunittests C) -if (NOT CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") message(FATAL_ERROR "Unit test are currently only working on Linux or Darwin") endif() @@ -10,7 +10,7 @@ set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) set(LWIP_USE_SANITIZERS true) include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake) -if(CMAKE_C_COMPILER_ID STREQUAL Clang) +if(CMAKE_C_COMPILER_ID STREQUAL "Clang") # check.h causes 'error: token pasting of ',' and __VA_ARGS__ is a GNU extension' with clang 9.0.0 list(LWIP_COMPILER_FLAGS APPEND -Wno-gnu-zero-variadic-macro-arguments) endif() @@ -37,20 +37,20 @@ find_library(LIBCHECK check) find_library(LIBM m) target_link_libraries(lwip_unittests ${LWIP_SANITIZER_LIBS} lwipallapps lwipcore ${LIBCHECK} ${LIBM}) -if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") # check installed via brew on Darwin doesn't have a separate subunit library (must be statically linked) find_library(LIBSUBUNIT subunit) target_link_libraries(lwip_unittests ${LIBSUBUNIT}) endif() -if (CMAKE_SYSTEM_NAME STREQUAL Linux) +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") find_library(LIBUTIL util) find_library(LIBPTHREAD pthread) find_library(LIBRT rt) target_link_libraries(lwip_unittests ${LIBUTIL} ${LIBPTHREAD} ${LIBRT}) endif() -if (CMAKE_SYSTEM_NAME STREQUAL Darwin) +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") # Darwin doesn't have pthreads or POSIX real-time extensions libs find_library(LIBUTIL util) target_link_libraries(lwip_unittests ${LIBUTIL}) diff --git a/contrib/ports/unix/lib/CMakeLists.txt b/contrib/ports/unix/lib/CMakeLists.txt index 644d3598..93d17bd0 100644 --- a/contrib/ports/unix/lib/CMakeLists.txt +++ b/contrib/ports/unix/lib/CMakeLists.txt @@ -4,7 +4,7 @@ project(lwip C) set (BUILD_SHARED_LIBS ON) -if (NOT CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CMAKE_SYSTEM_NAME STREQUAL GNU) +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "GNU") message(FATAL_ERROR "Lwip shared library is only working on Linux or the Hurd") endif()