Files
GameNetworkingSockets/examples/vcpkg_example_chat/CMakeLists.txt
T
Fletcher Dunn 91465451d0 vcpkg fixes
vcpkg manigest:
- Add vcpkg-cmake as dependency of this project
- Don't support bcrypt as vcpkg feature.  Nobody using vcpkg wants bcrypt,
  so this is just a trap.

Local/test overlay port:
- Fix how we are setting SOURCE_PATH
- Add symlink to out vcpkg.json manifest, since a port needs one

Chat example built using vcpkg:
- Add GNS_LINK_STATIC option to vcpkg_example_chat project so I can test
  an app linking against static or dynamic lib.
2026-05-28 14:41:44 -07:00

25 lines
800 B
CMake

#
# Example porject that uses GameNetworkingSockets, obtaining
# dependencies, etc entirely through vcpkg.
#
cmake_minimum_required(VERSION 3.10)
project( example_chat_vcpkg )
# Ask vcpkg to fetch gamenetworkingsockets and all
# its dependencies and build it
find_package(GameNetworkingSockets CONFIG REQUIRED)
# Our program only has one cpp file
add_executable(
example_chat
../example_chat.cpp)
# Link against shared or static depending on how vcpkg built the library.
# Pass -DGNS_LINK_STATIC=ON to link statically (e.g. with x64-windows-static triplet).
option(GNS_LINK_STATIC "Link GameNetworkingSockets statically" OFF)
if(GNS_LINK_STATIC)
target_link_libraries(example_chat GameNetworkingSockets::static)
else()
target_link_libraries(example_chat GameNetworkingSockets::shared)
endif()