Skip to content

Fix #311, removed unnecessary check for CMAKE_BUILD_TYPE #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
PROJECT(sioclient)
PROJECT(sioclient
VERSION 3.1.0
)

option(BUILD_SHARED_LIBS "Build the shared library" OFF)
option(BUILD_UNIT_TESTS "Builds unit tests target" OFF)
option(BUILD_UNIT_TESTS "Builds unit tests target" OFF)

set(MAJOR 1)
set(MINOR 6)
set(PATCH 0)

Comment on lines -7 to -10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not remove these lines as, MAJOR, MINOR and PATCH are being used as a CMake property

if(NOT CMAKE_BUILD_TYPE )
MESSAGE(STATUS "not define build type, set to release" )
set(CMAKE_BUILD_TYPE Release )
elseif(NOT (${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "Debug" ))
MESSAGE(SEND_ERROR "CMAKE_BUILD_TYPE must be either Release or Debug")
return()
endif()
if (NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/asio/asio/README)
message("Updating submodules")
execute_process(
COMMAND git submodule update --init
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif ()
Comment on lines +9 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the developer responsibility to do this and not the CMake. We want to keep the CMakeLists.txt minimal if possible.

Suggested change
if (NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/asio/asio/README)
message("Updating submodules")
execute_process(
COMMAND git submodule update --init
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif ()
set(MAJOR 1)
set(MINOR 6)
set(PATCH 0)


aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src ALL_SRC)
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/internal ALL_SRC)
file(GLOB ALL_HEADERS ${CMAKE_CURRENT_LIST_DIR}/src/*.h )
set(SIO_INCLUDEDIR ${CMAKE_CURRENT_LIST_DIR})

file(GLOB ALL_HEADERS ${CMAKE_CURRENT_LIST_DIR}/src/*.h)

add_definitions(
# These will force ASIO to compile without Boost
Expand All @@ -32,10 +29,10 @@ add_definitions(
)

add_library(sioclient ${ALL_SRC})
target_include_directories(sioclient PUBLIC
target_include_directories(sioclient PUBLIC
${CMAKE_CURRENT_LIST_DIR}/src
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/lib/websocketpp
${CMAKE_CURRENT_LIST_DIR}/lib/websocketpp
${CMAKE_CURRENT_LIST_DIR}/lib/rapidjson/include
${CMAKE_CURRENT_LIST_DIR}/lib/asio/asio/include
)
Expand All @@ -61,7 +58,7 @@ add_library(sioclient_tls ${ALL_SRC})
target_include_directories(sioclient_tls PUBLIC
${CMAKE_CURRENT_LIST_DIR}/src
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/lib/websocketpp
${CMAKE_CURRENT_LIST_DIR}/lib/websocketpp
${CMAKE_CURRENT_LIST_DIR}/lib/rapidjson/include
${CMAKE_CURRENT_LIST_DIR}/lib/asio/asio/include
${OPENSSL_INCLUDE_DIR}
Expand Down