2023-09-17 11:53:24 +00:00
|
|
|
cmake_minimum_required(VERSION 3.12)
|
|
|
|
project(MySocketIOApp)
|
2023-07-05 07:10:28 +00:00
|
|
|
|
2023-09-17 11:53:24 +00:00
|
|
|
# Include ExternalProject module
|
|
|
|
include(ExternalProject)
|
2023-07-05 07:10:28 +00:00
|
|
|
|
2023-09-17 11:53:24 +00:00
|
|
|
# Set up the external project
|
|
|
|
ExternalProject_Add(
|
|
|
|
socketio-client-cpp
|
|
|
|
PREFIX ${CMAKE_BINARY_DIR}/external
|
|
|
|
GIT_REPOSITORY https://github.com/socketio/socket.io-client-cpp.git
|
|
|
|
GIT_TAG master # You can change this to a specific release/tag if needed
|
|
|
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
|
|
|
)
|
2023-07-05 07:10:28 +00:00
|
|
|
|
2023-09-17 11:53:24 +00:00
|
|
|
# Add your project's executable or library here
|
|
|
|
add_executable(MySocketIOApp main.cpp)
|
2023-07-05 07:10:28 +00:00
|
|
|
|
2023-09-17 11:53:24 +00:00
|
|
|
# Include the socket.io-client-cpp header files
|
|
|
|
target_include_directories(MySocketIOApp PRIVATE
|
|
|
|
${CMAKE_BINARY_DIR}/external/include
|
|
|
|
${CMAKE_BINARY_DIR}/external/include/socket.io-client-cpp # Add this line
|
2023-07-05 07:10:28 +00:00
|
|
|
)
|
2023-09-17 11:53:24 +00:00
|
|
|
# This is required for googletest
|
|
|
|
find_package(sioclient)
|
|
|
|
# Link your project with the socket.io-client-cpp library
|
|
|
|
target_include_directories(MySocketIOApp PRIVATE ${CMAKE_BINARY_DIR}/external/include)
|
|
|
|
target_link_directories(MySocketIOApp PRIVATE ${CMAKE_BINARY_DIR}/external/lib)
|
|
|
|
target_link_libraries(MySocketIOApp PRIVATE sioclient)
|