Permalink
Browse files

Adjusted CMake configuration to build with SFML 2.5, SFML_DIR has to …

…be set now instead of SFML_ROOT.
  • Loading branch information...
binary1248 committed Jun 14, 2018
1 parent 67f3171 commit 15ffa6f9657d6ad799b6bddfcbd682202a3fe8dc
Showing with 11 additions and 8 deletions.
  1. +11 −8 CMakeLists.txt
View
@@ -13,12 +13,16 @@ set( SFGUI_BUILD_DOC false CACHE BOOL "Generate API documentation." )
set( SFGUI_INCLUDE_FONT true CACHE BOOL "Include default font in library (DejaVuSans)." )
set( SFML_STATIC_LIBRARIES false CACHE BOOL "Do you want to link SFML statically?" )
# Tell CMake where to find additional find modules
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/" )
# Automatically grab SFML_DIR from the environment if it exists, or force the user to specify it if it doesn't.
set( SFML_DIR "$ENV{SFML_DIR}" CACHE PATH "SFML root directory." )
if( "${SFML_DIR}" STREQUAL "" )
message( FATAL_ERROR "The SFML_DIR environment variable was not found. Please set SFML_DIR to the directory where SFML is located." )
endif()
# Find packages.
find_package( OpenGL REQUIRED )
find_package( SFML 2.3 REQUIRED COMPONENTS graphics window system )
find_package( SFML 2.5 REQUIRED COMPONENTS graphics window system )
# Find X11 for glX on Linux, checking for UNIX would match other UNIX systems as well
if( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" )
@@ -190,7 +194,6 @@ endif()
include_directories( "${INCLUDE_PATH}" )
include_directories( "${SOURCE_PATH}" )
include_directories( SYSTEM "${SFML_INCLUDE_DIR}" )
include_directories( SYSTEM "${PROJECT_SOURCE_DIR}/extlibs/libELL/include" )
# Set the library output directory
@@ -244,7 +247,7 @@ if( WIN32 )
endif()
add_definitions( -DWIN32 )
target_link_libraries( sfgui ${SFML_LIBRARIES} ${SFML_DEPENDENCIES} ${OPENGL_gl_LIBRARY} )
target_link_libraries( sfgui sfml-graphics sfml-window sfml-system ${OPENGL_gl_LIBRARY} )
if( CMAKE_COMPILER_IS_GNUCXX )
if( SFGUI_BUILD_SHARED_LIBS )
@@ -261,11 +264,11 @@ elseif( APPLE )
mark_as_advanced( COREFOUNDATION_LIBRARY )
include_directories( SYSTEM /System/Library/Frameworks/CoreFoundation.framework/Headers )
target_link_libraries( sfgui ${SFML_LIBRARIES} ${SFML_DEPENDENCIES} ${OPENGL_gl_LIBRARY} ${COREFOUNDATION_LIBRARY} )
target_link_libraries( sfgui sfml-graphics sfml-window sfml-system ${OPENGL_gl_LIBRARY} ${COREFOUNDATION_LIBRARY} )
set( SHARE_PATH "${CMAKE_INSTALL_PREFIX}/share/SFGUI" )
set( LIB_PATH "lib" )
elseif( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" )
target_link_libraries( sfgui ${SFML_LIBRARIES} ${SFML_DEPENDENCIES} ${OPENGL_gl_LIBRARY} ${X11_LIBRARIES} )
target_link_libraries( sfgui sfml-graphics sfml-window sfml-system ${OPENGL_gl_LIBRARY} ${X11_LIBRARIES} )
set( SHARE_PATH "${CMAKE_INSTALL_PREFIX}/share/SFGUI" )
if( LIB_SUFFIX )
@@ -274,7 +277,7 @@ elseif( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" )
set( LIB_PATH "lib" )
endif()
else()
target_link_libraries( sfgui ${SFML_LIBRARIES} ${SFML_DEPENDENCIES} ${OPENGL_gl_LIBRARY} )
target_link_libraries( sfgui sfml-graphics sfml-window sfml-system ${OPENGL_gl_LIBRARY} )
set( SHARE_PATH "${CMAKE_INSTALL_PREFIX}/share/SFGUI" )
set( LIB_PATH "lib" )
endif()

0 comments on commit 15ffa6f

Please sign in to comment.