Fix comparison of boolean values in CMake build.

Closes #1101. Thanks to Mojca Miklavec and Andrew L. Moore.
This commit is contained in:
Roger A. Light 2019-01-10 15:51:34 +00:00
parent f6943b006a
commit 70c4097b6f
6 changed files with 52 additions and 47 deletions

View File

@ -51,7 +51,7 @@ option(WITH_TLS_PSK
"Include TLS-PSK support (requires WITH_TLS)?" ON)
option(WITH_EC
"Include Elliptic Curve support (requires WITH_TLS)?" ON)
if (${WITH_TLS} STREQUAL ON)
if (WITH_TLS)
find_package(OpenSSL REQUIRED)
add_definitions("-DWITH_TLS")
@ -62,19 +62,19 @@ if (${WITH_TLS} STREQUAL ON)
if (${WITH_EC} STREQUAL ON)
add_definitions("-DWITH_EC")
endif (${WITH_EC} STREQUAL ON)
else (${WITH_TLS} STREQUAL ON)
else (WITH_TLS)
set (OPENSSL_INCLUDE_DIR "")
endif (${WITH_TLS} STREQUAL ON)
endif (WITH_TLS)
option(WITH_SOCKS "Include SOCKS5 support?" ON)
if (${WITH_SOCKS} STREQUAL ON)
if (WITH_SOCKS)
add_definitions("-DWITH_SOCKS")
endif (${WITH_SOCKS} STREQUAL ON)
endif (WITH_SOCKS)
option(WITH_SRV "Include SRV lookup support?" OFF)
option(WITH_THREADING "Include client library threading support?" ON)
if (${WITH_THREADING} STREQUAL ON)
if (WITH_THREADING)
add_definitions("-DWITH_THREADING")
if (WIN32)
if (CMAKE_CL_64)
@ -92,10 +92,10 @@ if (${WITH_THREADING} STREQUAL ON)
endif()
set (PTHREAD_INCLUDE_DIR "")
endif (WIN32)
else (${WITH_THREADING} STREQUAL ON)
else (WITH_THREADING)
set (PTHREAD_LIBRARIES "")
set (PTHREAD_INCLUDE_DIR "")
endif (${WITH_THREADING} STREQUAL ON)
endif (WITH_THREADING)
option(DOCUMENTATION "Build documentation?" ON)
@ -106,9 +106,9 @@ option(DOCUMENTATION "Build documentation?" ON)
add_subdirectory(lib)
add_subdirectory(client)
add_subdirectory(src)
if (${DOCUMENTATION} STREQUAL ON)
if (DOCUMENTATION)
add_subdirectory(man)
endif (${DOCUMENTATION} STREQUAL ON)
endif (DOCUMENTATION)
# ========================================
# Install config file

View File

@ -1,3 +1,10 @@
1.5.6 - 201901xx
================
Build:
- Fix comparison of boolean values in CMake build. Closes #1101.
1.5.5 - 20181211
================

View File

@ -4,9 +4,9 @@ link_directories(${mosquitto_BINARY_DIR}/lib)
set(shared_src client_shared.c client_shared.h)
if (${WITH_SRV} STREQUAL ON)
if (WITH_SRV)
add_definitions("-DWITH_SRV")
endif (${WITH_SRV} STREQUAL ON)
endif (WITH_SRV)
add_executable(mosquitto_pub pub_client.c ${shared_src})
add_executable(mosquitto_sub sub_client.c sub_client_output.c ${shared_src})

View File

@ -60,7 +60,7 @@ if (WIN32)
set (LIBRARIES ${LIBRARIES} ws2_32)
endif (WIN32)
if (${WITH_SRV} STREQUAL ON)
if (WITH_SRV)
# Simple detect c-ares
find_path(ARES_HEADER ares.h)
if (ARES_HEADER)
@ -69,7 +69,7 @@ if (${WITH_SRV} STREQUAL ON)
else (ARES_HEADER)
message(WARNING "c-ares library not found.")
endif (ARES_HEADER)
endif (${WITH_SRV} STREQUAL ON)
endif (WITH_SRV)
add_library(libmosquitto SHARED ${C_SRC})
set_target_properties(libmosquitto PROPERTIES
@ -86,13 +86,13 @@ set_target_properties(libmosquitto PROPERTIES
install(TARGETS libmosquitto RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
if (${WITH_STATIC_LIBRARIES} STREQUAL ON)
if (WITH_STATIC_LIBRARIES)
add_library(libmosquitto_static STATIC ${C_SRC})
if (${WITH_PIC} STREQUAL ON)
if (WITH_PIC)
set_target_properties(libmosquitto_static PROPERTIES
POSITION_INDEPENDENT_CODE 1
)
endif (${WITH_PIC} STREQUAL ON)
endif (WITH_PIC)
target_link_libraries(libmosquitto_static ${LIBRARIES})
@ -103,7 +103,7 @@ if (${WITH_STATIC_LIBRARIES} STREQUAL ON)
target_compile_definitions(libmosquitto_static PUBLIC "LIBMOSQUITTO_STATIC")
install(TARGETS libmosquitto_static RUNTIME DESTINATION "${BINDIR}" ARCHIVE DESTINATION "${LIBDIR}")
endif (${WITH_STATIC_LIBRARIES} STREQUAL ON)
endif (WITH_STATIC_LIBRARIES)
install(FILES mosquitto.h DESTINATION "${INCLUDEDIR}")

View File

@ -15,16 +15,16 @@ set_target_properties(mosquittopp PROPERTIES
)
install(TARGETS mosquittopp RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
if (${WITH_STATIC_LIBRARIES} STREQUAL ON)
if (WITH_STATIC_LIBRARIES)
add_library(mosquittopp_static STATIC
${C_SRC}
${CPP_SRC}
)
if (${WITH_PIC} STREQUAL ON)
if (WITH_PIC)
set_target_properties(mosquittopp_static PROPERTIES
POSITION_INDEPENDENT_CODE 1
)
endif (${WITH_PIC} STREQUAL ON)
endif (WITH_PIC)
target_link_libraries(mosquittopp_static ${LIBRARIES})
@ -35,7 +35,7 @@ if (${WITH_STATIC_LIBRARIES} STREQUAL ON)
target_compile_definitions(mosquittopp_static PUBLIC "LIBMOSQUITTO_STATIC")
install(TARGETS mosquittopp_static RUNTIME DESTINATION "${BINDIR}" ARCHIVE DESTINATION "${LIBDIR}")
endif (${WITH_STATIC_LIBRARIES} STREQUAL ON)
endif (WITH_STATIC_LIBRARIES)
install(FILES mosquittopp.h DESTINATION "${INCLUDEDIR}")

View File

@ -52,62 +52,62 @@ set (MOSQ_SRCS
option(WITH_BUNDLED_DEPS "Build with bundled dependencies?" ON)
if (${WITH_BUNDLED_DEPS} STREQUAL ON)
if (WITH_BUNDLED_DEPS)
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/src/deps)
endif (${WITH_BUNDLED_DEPS} STREQUAL ON)
endif (WITH_BUNDLED_DEPS)
option(INC_BRIDGE_SUPPORT
"Include bridge support for connecting to other brokers?" ON)
if (${INC_BRIDGE_SUPPORT} STREQUAL ON)
if (INC_BRIDGE_SUPPORT)
set (MOSQ_SRCS ${MOSQ_SRCS} bridge.c)
add_definitions("-DWITH_BRIDGE")
endif (${INC_BRIDGE_SUPPORT} STREQUAL ON)
endif (INC_BRIDGE_SUPPORT)
option(USE_LIBWRAP
"Include tcp-wrappers support?" OFF)
if (${USE_LIBWRAP} STREQUAL ON)
if (USE_LIBWRAP)
set (MOSQ_LIBS ${MOSQ_LIBS} wrap)
add_definitions("-DWITH_WRAP")
endif (${USE_LIBWRAP} STREQUAL ON)
endif (USE_LIBWRAP)
option(INC_DB_UPGRADE
"Include database upgrade support? (recommended)" ON)
option(INC_MEMTRACK
"Include memory tracking support?" ON)
if (${INC_MEMTRACK} STREQUAL ON)
if (INC_MEMTRACK)
add_definitions("-DWITH_MEMORY_TRACKING")
endif (${INC_MEMTRACK} STREQUAL ON)
endif (INC_MEMTRACK)
option(WITH_PERSISTENCE
"Include persistence support?" ON)
if (${WITH_PERSISTENCE} STREQUAL ON)
if (WITH_PERSISTENCE)
add_definitions("-DWITH_PERSISTENCE")
endif (${WITH_PERSISTENCE} STREQUAL ON)
endif (WITH_PERSISTENCE)
option(WITH_SYS_TREE
"Include $SYS tree support?" ON)
if (${WITH_SYS_TREE} STREQUAL ON)
if (WITH_SYS_TREE)
add_definitions("-DWITH_SYS_TREE")
endif (${WITH_SYS_TREE} STREQUAL ON)
endif (WITH_SYS_TREE)
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
option(WITH_SYSTEMD
"Include systemd support?" OFF)
if (${WITH_SYSTEMD} STREQUAL ON)
if (WITH_SYSTEMD)
add_definitions("-DWITH_SYSTEMD")
find_library(SYSTEMD_LIBRARY systemd)
set (MOSQ_LIBS ${MOSQ_LIBS} ${SYSTEMD_LIBRARY})
endif (${WITH_SYSTEMD} STREQUAL ON)
endif (WITH_SYSTEMD)
endif (CMAKE_SYSTEM_NAME STREQUAL Linux)
option(WITH_WEBSOCKETS "Include websockets support?" OFF)
option(STATIC_WEBSOCKETS "Use the static libwebsockets library?" OFF)
if (${WITH_WEBSOCKETS} STREQUAL ON )
if (WITH_WEBSOCKETS)
add_definitions("-DWITH_WEBSOCKETS")
endif (${WITH_WEBSOCKETS} STREQUAL ON)
endif (WITH_WEBSOCKETS)
if (WIN32 OR CYGWIN)
set (MOSQ_SRCS ${MOSQ_SRCS} service.c)
@ -144,17 +144,17 @@ if (WIN32)
set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32)
endif (WIN32)
if (${WITH_WEBSOCKETS} STREQUAL ON)
if (${STATIC_WEBSOCKETS} STREQUAL ON)
if (WITH_WEBSOCKETS)
if (STATIC_WEBSOCKETS)
set (MOSQ_LIBS ${MOSQ_LIBS} websockets_static)
if (WIN32)
set (MOSQ_LIBS ${MOSQ_LIBS} iphlpapi)
link_directories(${mosquitto_SOURCE_DIR})
endif (WIN32)
else (${STATIC_WEBSOCKETS} STREQUAL ON)
else (STATIC_WEBSOCKETS)
set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
endif (${STATIC_WEBSOCKETS} STREQUAL ON)
endif (${WITH_WEBSOCKETS} STREQUAL ON)
endif (STATIC_WEBSOCKETS)
endif (WITH_WEBSOCKETS)
# Simple detect libuuid
if(NOT APPLE)
@ -179,14 +179,12 @@ endif (UNIX)
install(TARGETS mosquitto RUNTIME DESTINATION "${SBINDIR}" LIBRARY DESTINATION "${LIBDIR}")
install(FILES mosquitto_broker.h mosquitto_plugin.h DESTINATION "${INCLUDEDIR}")
if (${WITH_TLS} STREQUAL ON)
if (WITH_TLS)
add_executable(mosquitto_passwd mosquitto_passwd.c)
target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES})
install(TARGETS mosquitto_passwd RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
endif (${WITH_TLS} STREQUAL ON)
endif (WITH_TLS)
if (UNIX AND NOT APPLE)
install(CODE "EXEC_PROGRAM(/sbin/ldconfig)")
endif (UNIX AND NOT APPLE)