Advertisement
Guest User

Untitled

a guest
Oct 12th, 2021
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. cmake_minimum_required(VERSION 3.5.1)
  2.  
  3. include(${CMAKE_CURRENT_SOURCE_DIR}/cmake_helpers/helpers.cmake)
  4.  
  5. set(CMAKE_MODULE_PATH
  6. ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake_helpers/find_modules)
  7.  
  8. project(hello_world LANGUAGES CXX)
  9.  
  10. if(UNIX)
  11. set(SDL2_image_name SDL2_image)
  12. set(SDL2_ttf_name SDL2_ttf)
  13. set(SDL2_mixer_name SDL2_mixer)
  14. elseif(WIN32 OR APPLE)
  15. set(SDL2_image_name SDL2_IMAGE)
  16. set(SDL2_ttf_name SDL2_TTF)
  17. set(SDL2_mixer_name SDL2_MIXER)
  18. endif()
  19.  
  20. find_package(SDL2 REQUIRED)
  21. find_package(SDL2_image REQUIRED)
  22. find_package(${SDL2_ttf_name} REQUIRED)
  23. find_package(${SDL2_mixer_name} REQUIRED)
  24.  
  25. set(_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
  26.  
  27. add_executable(${PROJECT_NAME} ${_BASE_DIR}/main.cpp)
  28.  
  29. set_target_cpp_standard(${PROJECT_NAME} 17)
  30. enable_target_warnings(${PROJECT_NAME})
  31.  
  32. target_include_directories(
  33. ${PROJECT_NAME} PRIVATE
  34. ${_BASE_DIR}
  35. ${SDL2_INCLUDE_DIR}
  36. ${SDL2_IMAGE_INCLUDE_DIR}
  37. ${SDL2_TTF_INCLUDE_DIR}
  38. ${SDL2_MIXER_INCLUDE_DIR}
  39. )
  40.  
  41. target_link_libraries(
  42. ${PROJECT_NAME} PRIVATE
  43. ${SDL2_LIBRARY}
  44. ${SDL2_IMAGE_LIBRARY}
  45. ${SDL2_TTF_LIBRARY}
  46. ${SDL2_MIXER_LIBRARY}
  47. )
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement