CMakeLists.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Copyright (c) 2008-2023 the Urho3D project
  2. # License: MIT
  3. if (NOT URHO3D_SAMPLES)
  4. return ()
  5. endif ()
  6. # Set project name
  7. project (Urho3D-Samples)
  8. # В IDE примеры будут помещаться в папку samples
  9. set (CMAKE_FOLDER samples)
  10. # Find Urho3D library
  11. find_package (Urho3D REQUIRED)
  12. include_directories (${URHO3D_INCLUDE_DIRS})
  13. # Include common to all samples
  14. set (COMMON_SAMPLE_H_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Sample.h" "${CMAKE_CURRENT_SOURCE_DIR}/Sample.inl")
  15. # Define dependency libs
  16. set (INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
  17. # Macro for adding sample subdirectory
  18. macro (add_sample_subdirectory SOURCE_DIR)
  19. if (DEFINED ENV{included_sample})
  20. if (DEFINED ENV{INCLUDED_SAMPLE_${SOURCE_DIR}})
  21. add_subdirectory (${SOURCE_DIR} ${ARGN})
  22. endif ()
  23. elseif (NOT DEFINED ENV{EXCLUDED_SAMPLE_${SOURCE_DIR}})
  24. add_subdirectory (${SOURCE_DIR} ${ARGN})
  25. endif ()
  26. endmacro ()
  27. # Add samples
  28. file (GLOB_RECURSE DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CMakeLists.txt)
  29. list (SORT DIRS)
  30. foreach (DIR ${DIRS})
  31. get_filename_component (DIR ${DIR} PATH)
  32. if (DIR)
  33. add_sample_subdirectory (${DIR})
  34. endif ()
  35. endforeach ()