CMakeLists.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. #
  4. # SPDX-License-Identifier: Apache-2.0 OR MIT
  5. #
  6. #
  7. #! Adds the --project-path argument to the VS IDE debugger command arguments
  8. function(add_vs_debugger_arguments)
  9. # Inject the project root into the --project-path argument into the Visual Studio Debugger arguments by defaults
  10. list(APPEND app_targets MultiplayerSample.GameLauncher MultiplayerSample.ServerLauncher)
  11. list(APPEND app_targets AssetBuilder AssetProcessor AssetProcessorBatch Editor)
  12. foreach(app_target IN LISTS app_targets)
  13. if (TARGET ${app_target})
  14. set_property(TARGET ${app_target} APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${CMAKE_CURRENT_LIST_DIR}\"")
  15. endif()
  16. endforeach()
  17. endfunction()
  18. if(NOT PROJECT_NAME)
  19. cmake_minimum_required(VERSION 3.19)
  20. project(MultiplayerSample
  21. LANGUAGES C CXX
  22. VERSION 1.0.0.0
  23. )
  24. include(EngineFinder.cmake OPTIONAL)
  25. find_package(o3de REQUIRED)
  26. o3de_initialize()
  27. add_vs_debugger_arguments()
  28. else()
  29. # Add the project_name to global LY_PROJECTS_TARGET_NAME property
  30. file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json)
  31. string(JSON project_target_name ERROR_VARIABLE json_error GET ${project_json} "project_name")
  32. if(json_error)
  33. message(FATAL_ERROR "Unable to read key 'project_name' from 'project.json'")
  34. endif()
  35. set_property(GLOBAL APPEND PROPERTY LY_PROJECTS_TARGET_NAME ${project_target_name})
  36. add_subdirectory(Gem)
  37. endif()