CMakeLists.txt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. include(cmake/CompilerSettings.cmake)
  22. project(NetSoakTest
  23. LANGUAGES C CXX
  24. VERSION 1.0.0.0
  25. )
  26. include(cmake/EngineFinder.cmake OPTIONAL)
  27. find_package(o3de REQUIRED)
  28. o3de_initialize()
  29. add_vs_debugger_arguments()
  30. else()
  31. # Add the project_name to global LY_PROJECTS_TARGET_NAME property
  32. file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json)
  33. string(JSON project_target_name ERROR_VARIABLE json_error GET ${project_json} "project_name")
  34. if(json_error)
  35. message(FATAL_ERROR "Unable to read key 'project_name' from 'project.json'")
  36. endif()
  37. set_property(GLOBAL APPEND PROPERTY LY_PROJECTS_TARGET_NAME ${project_target_name})
  38. add_subdirectory(Gem)
  39. endif()