Advertisement
Lumi_V

Main CMake File

Dec 15th, 2023
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 2.03 KB | None | 0 0
  1. ## Steps to follow - Generate the project
  2. # Create source and CMakeLists
  3. # 1) mkdir build
  4. # 2) cd build
  5. # 3) cmake .. -> Generating the build files/Configuring the project
  6. # 4) cmake --build . -> Command to build all targets
  7. # 5) ./Executable
  8.  
  9. ## Steps to follow - Update project
  10. # 1) cd build
  11. # 2) cmake .
  12.  
  13. cmake_minimum_required(VERSION 3.24)
  14.  
  15. project(
  16.     HelloWorld
  17.     VERSION 1.0.0
  18.     LANGUAGES C CXX
  19.     )
  20.  
  21. # Setting the language version
  22. set(CXX_STANDARD_REQUIRED 17)
  23.  
  24. # Making it so the language is enforced
  25. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  26.  
  27. # For external libraries
  28. set(CMAKE_CXX_EXTENSIONS OFF)
  29.  
  30. # Setting the Executable and Library Name
  31. set(EXTERN_LIBRARY_NAME Library_External)
  32. set(EXECUTABLE_NAME Executable)
  33. set(LIBRARY_NAME Library)
  34.  
  35. # Add external libraries manually
  36. # Setting the Cmake modules path to our custom path
  37. set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
  38.  
  39. ## Adding extra modules
  40. include(FetchContent)
  41. include(AddGitSubmodules)
  42.  
  43. # Adding git libraries with inbuilt function
  44. FetchContent_Declare(
  45.     Vulkan-Headers
  46.     GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Headers"
  47.     GIT_TAG v1.3.204
  48.     GIT_SHALLOW TRUE
  49. )
  50.  
  51. FetchContent_MakeAvailable(Vulkan-Headers)
  52.  
  53. FetchContent_Declare(
  54.     glm
  55.     GIT_REPOSITORY "https://github.com/g-truc/glm"
  56.     GIT_TAG 0.9.9.8
  57.     GIT_SHALLOW TRUE
  58. )
  59.  
  60. FetchContent_MakeAvailable(glm)
  61.  
  62. FetchContent_Declare(
  63.     glfw
  64.     GIT_REPOSITORY "https://github.com/glfw/glfw"
  65.     GIT_TAG 3.3.8
  66.     GIT_SHALLOW TRUE
  67. )
  68.  
  69. FetchContent_MakeAvailable(glfw)
  70.  
  71. FetchContent_Declare(
  72.     assimp
  73.     GIT_REPOSITORY "https://github.com/assimp/assimp"
  74.     GIT_TAG v5.3.1
  75.     GIT_SHALLOW TRUE
  76. )
  77.  
  78. FetchContent_MakeAvailable(assimp)
  79.  
  80. # Calling the function
  81. #add_git_submodules(extern/glew)
  82.  
  83. # Since src (Application) is dependent on include (Custom Libraries)
  84. # We include them in a reverse order, otherwise
  85. # The application will throw an error while building
  86. add_subdirectory(extern)
  87. add_subdirectory(include)
  88. add_subdirectory(src)
  89.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement