2016-03-21 18:49:47 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2016-04-11 21:38:03 +00:00
|
|
|
project(skizzle)
|
2016-03-12 18:03:01 +00:00
|
|
|
|
|
|
|
# Inclusion des fichiers d'en-tête et de source
|
|
|
|
include_directories(include)
|
2016-04-10 12:07:21 +00:00
|
|
|
file(GLOB SOURCES "src/*.cpp")
|
2016-03-12 18:03:01 +00:00
|
|
|
|
|
|
|
# Affichage de tous les avertisements
|
|
|
|
if(MSVC)
|
|
|
|
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
|
|
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
|
|
endif()
|
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
|
|
|
|
endif()
|
|
|
|
|
2016-03-30 12:25:31 +00:00
|
|
|
# Standard C++14
|
2016-03-21 18:49:47 +00:00
|
|
|
include(CheckCXXCompilerFlag)
|
2016-03-31 08:20:09 +00:00
|
|
|
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
2016-03-21 18:49:47 +00:00
|
|
|
|
2016-03-31 08:20:09 +00:00
|
|
|
if(COMPILER_SUPPORTS_CXX11)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
|
|
elseif(COMPILER_SUPPORTS_CXX0X)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
2016-03-21 18:49:47 +00:00
|
|
|
else()
|
2016-03-31 08:20:09 +00:00
|
|
|
message(STATUS "Le compilateur actuel (${CMAKE_CXX_COMPILER}) ne supporte pas C++11. Merci d'utiliser un autre compilateur.")
|
2016-03-21 18:49:47 +00:00
|
|
|
endif()
|
2016-03-12 18:03:01 +00:00
|
|
|
|
|
|
|
# Recherche des librairies
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}" ${CMAKE_MODULE_PATH})
|
2016-04-11 21:38:03 +00:00
|
|
|
add_executable(skizzle ${SOURCES})
|
2016-04-10 10:27:06 +00:00
|
|
|
|
2016-03-12 18:03:01 +00:00
|
|
|
find_package(SFML 2 REQUIRED system window graphics network audio)
|
2016-04-10 10:27:06 +00:00
|
|
|
find_package(Boost 1.60.0 COMPONENTS system filesystem)
|
|
|
|
|
|
|
|
include_directories(${SFML_INCLUDE_DIRS})
|
|
|
|
include_directories(${Boost_INCLUDE_DIRS})
|
|
|
|
|
2016-04-11 21:38:03 +00:00
|
|
|
target_link_libraries(skizzle ${SFML_LIBRARIES})
|
|
|
|
target_link_libraries(skizzle ${Boost_LIBRARIES})
|
2016-03-12 18:03:01 +00:00
|
|
|
|
|
|
|
# Installation de l'exécutable
|
2016-04-11 21:38:03 +00:00
|
|
|
install(TARGETS skizzle DESTINATION bin)
|