SFML/CMakeLists.txt

65 lines
1.8 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 2.8)
# set a default build type if none was provided
# this has to be done before the project() instruction!
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
# project name
project(SFML)
# include the configuration file
include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
# setup version numbers
set(VERSION_MAJOR 2)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
# add the SFML header path
include_directories(${CMAKE_SOURCE_DIR}/include)
# add an option for choosing the build type (shared or static)
set(BUILD_SHARED_LIBS TRUE CACHE BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries")
# add an option for building the examples
set(BUILD_EXAMPLES FALSE CACHE BOOL "TRUE to build the SFML examples, FALSE to ignore them")
# add an option for building the API documentation
set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
# define SFML_DYNAMIC if the build type is set to 'shared'
if(BUILD_SHARED_LIBS)
add_definitions(-DSFML_DYNAMIC)
endif()
# remove SL security warnings with Visual C++
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif()
# disable the rpath stuff
set(CMAKE_SKIP_BUILD_RPATH TRUE)
# add the subdirectories
add_subdirectory(src/SFML)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(BUILD_DOC)
add_subdirectory(doc)
endif()
# setup the install rules
install(DIRECTORY include
DESTINATION .
COMPONENT devel
PATTERN ".svn" EXCLUDE)
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
if(WINDOWS)
install(FILES extlibs/bin/libsndfile-1.dll DESTINATION bin)
install(FILES extlibs/bin/openal32.dll DESTINATION bin)
endif()