agones.dev/agones@v1.53.0/examples/cpp-simple/CMakeLists.txt (about)

     1  # Copyright 2019 Google LLC All Rights Reserved.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  cmake_minimum_required(VERSION 3.15)
    16  
    17  project(cpp-simple CXX)
    18  
    19  # Settings
    20  set(CMAKE_CXX_STANDARD 17)
    21  set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
    22  set(CMAKE_CXX_EXTENSIONS OFF)
    23  set(CMAKE_INCLUDE_CURRENT_DIR ON)
    24  set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
    25  set_property(GLOBAL PROPERTY USE_FOLDERS ON)
    26  set(CMAKE_DEBUG_POSTFIX "d")
    27  
    28  find_package(Threads REQUIRED)
    29  find_package(agones CONFIG REQUIRED)
    30  
    31  if(WIN32)
    32    # Windows
    33    add_definitions(-D_WIN32_WINNT=0x0600)
    34    set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT cpp-simple)
    35  elseif(APPLE)
    36    # Mac OS
    37  elseif(UNIX AND NOT APPLE)
    38    # Linux
    39  endif()
    40  
    41  include_directories(${agones_INCLUDE_DIRS})
    42  set(SRC_FILES "server.cc")
    43  
    44  # Executable
    45  add_executable(${PROJECT_NAME} ${SRC_FILES})
    46  target_link_libraries(${PROJECT_NAME} PUBLIC agones)
    47  
    48  if (MSVS)
    49    target_compile_options(${PROJECT_NAME} PUBLIC /wd4101 /wd4146 /wd4251 /wd4661)
    50  endif()
    51  
    52  # Installation
    53  install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME} RUNTIME DESTINATION .)