CMakeLists.txt 1.6 KB

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