Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. # Load SDL2
  2. find_program(LSB_RELEASE_EXEC lsb_release)
  3. execute_process(COMMAND ${LSB_RELEASE_EXEC} -is OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
  4. message("Your distro is ${LSB_RELEASE_ID_SHORT}")
  5. find_package(SDL2 REQUIRED)
  6. if ("${LSB_RELEASE_ID_SHORT}" STREQUAL "Arch")
  7. message("Arch distro detected, using Arch CMake linkage")
  8. target_link_libraries(ProjectName SDL2::SDL2)
  9. else ()
  10. message("Non-Arch distro detected, using normal linkage")
  11. string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES) # Fix because CMake is stupid, remove trailing spaces
  12. include_directories(ProjectName ${SDL2_INCLUDE_DIRS})
  13. target_link_libraries(ProjectName ${SDL2_LIBRARIES})
  14. endif ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement