Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Change this if you need to target a specific CMake version
- cmake_minimum_required(VERSION 2.6)
- # Enable debug symbols by default
- # must be done before project() statement
- if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
- endif()
- # (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release)
- project(myproject)
- # Set version information in a config.h file
- set(myproject_VERSION_MAJOR 1)
- set(myproject_VERSION_MINOR 0)
- configure_file(
- "${PROJECT_SOURCE_DIR}/config.h.in"
- "${PROJECT_BINARY_DIR}/config.h"
- )
- include_directories("includes")
- # Define sources and executable
- file(GLOB SOURCES src/*.cpp includes/*)
- set(EXECUTABLE_NAME "myproject")
- add_executable(${EXECUTABLE_NAME} ${SOURCES})
- # Detect and add SFML
- set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/" ${CMAKE_MODULE_PATH})
- #Find any version 2.X of SFML
- #See the FindSFML.cmake file for additional details and instructions
- find_package(SFML 2 REQUIRED system window graphics network audio main)
- if(SFML_FOUND)
- include_directories(${SFML_INCLUDE_DIR})
- target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
- endif()
- # Install target
- install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
- # CPack packaging
- include(InstallRequiredSystemLibraries)
- set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
- set(CPACK_PACKAGE_VERSION_MAJOR "${myproject_VERSION_MAJOR}")
- set(CPACK_PACKAGE_VERSION_MINOR "${myproject_VERSION_MINOR}")
- include(CPack)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement