Advertisement
Guest User

Untitled

a guest
Oct 9th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 1.52 KB | None | 0 0
  1. #Change this if you need to target a specific CMake version
  2. cmake_minimum_required(VERSION 2.6)
  3.  
  4. # Enable debug symbols by default
  5. # must be done before project() statement
  6. if(NOT CMAKE_BUILD_TYPE)
  7.     set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
  8. endif()
  9. # (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release)
  10.  
  11. project(myproject)
  12.  
  13. # Set version information in a config.h file
  14. set(myproject_VERSION_MAJOR 1)
  15. set(myproject_VERSION_MINOR 0)
  16. configure_file(
  17.     "${PROJECT_SOURCE_DIR}/config.h.in"
  18.     "${PROJECT_BINARY_DIR}/config.h"
  19.     )
  20. include_directories("includes")
  21.  
  22. # Define sources and executable
  23. file(GLOB SOURCES src/*.cpp includes/*)
  24. set(EXECUTABLE_NAME "myproject")
  25. add_executable(${EXECUTABLE_NAME} ${SOURCES})
  26.  
  27.  
  28. # Detect and add SFML
  29. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/" ${CMAKE_MODULE_PATH})
  30. #Find any version 2.X of SFML
  31. #See the FindSFML.cmake file for additional details and instructions
  32. find_package(SFML 2 REQUIRED system window graphics network audio main)
  33. if(SFML_FOUND)
  34.     include_directories(${SFML_INCLUDE_DIR})
  35.     target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
  36. endif()
  37.  
  38.  
  39. # Install target
  40. install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
  41.  
  42.  
  43. # CPack packaging
  44. include(InstallRequiredSystemLibraries)
  45. set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
  46. set(CPACK_PACKAGE_VERSION_MAJOR "${myproject_VERSION_MAJOR}")
  47. set(CPACK_PACKAGE_VERSION_MINOR "${myproject_VERSION_MINOR}")
  48. include(CPack)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement