Advertisement
beefviper

XMLGameEngine - CMakeLists.txt

Sep 27th, 2020 (edited)
2,587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 1.75 KB | None | 0 0
  1. # CMakeList.txt : CMake project for XMLGameEngine, include source and define
  2. # project specific logic here.
  3. #
  4. cmake_minimum_required (VERSION 3.8)
  5.  
  6. set (CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE})
  7.  
  8. project ("XMLGameEngine")
  9.  
  10. if (MSVC)
  11.     add_compile_options(/bigobj)
  12. endif()
  13.  
  14. find_package (SFML REQUIRED system window graphics network audio)
  15. find_package (tinyxml2 CONFIG REQUIRED)
  16.  
  17. # Add source to this project's executable.
  18. add_executable (XMLGameEngine "main.cpp" "include/utils.h" "utils.cpp" "include/game.h" "game.cpp"
  19.     "include/engine.h" "engine.cpp" "include/object.h" "object.cpp" "include/states.h" "states.cpp"
  20.     "include/game_xml.h"  "include/game_expr.h"  "game_xml.cpp" "game_expr.cpp" "game_sfml.cpp")
  21.  
  22. target_include_directories(XMLGameEngine PUBLIC include)
  23.  
  24. target_link_libraries(XMLGameEngine PUBLIC sfml-system sfml-window sfml-graphics sfml-network sfml-audio)
  25. target_link_libraries(XMLGameEngine PRIVATE tinyxml2::tinyxml2)
  26.  
  27. add_dependencies(XMLGameEngine data-target)
  28.  
  29. # TODO: Add tests and install targets if needed.
  30.  
  31. # we don't want to copy if we're building in the source dir
  32. if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
  33.  
  34.     # list of files for which we add a copy rule
  35.     set(data_SHADOW games/pong.xml)
  36.  
  37.     foreach(item IN LISTS data_SHADOW)
  38.         message(STATUS ${item})
  39.         add_custom_command(
  40.             OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${item}"
  41.             COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${item}" "${CMAKE_CURRENT_BINARY_DIR}/${item}"
  42.             DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${item}"
  43.         )
  44.     endforeach()
  45. endif()
  46.  
  47. # files are only copied if a target depends on them
  48. add_custom_target(data-target ALL DEPENDS ${data_SHADOW})
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement