Some cleanup with USE_XRANDR flag

This commit is contained in:
Deve 2014-07-25 19:23:32 +02:00
parent f3746c068c
commit b9eb981fcc

View File

@ -17,7 +17,6 @@ option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
if(UNIX)
option(USE_CPP2011 "Activate C++ 2011 mode (GCC only)" OFF)
option(USE_XRANDR "Use xrandr instead of vidmode" OFF)
endif()
if(MSVC)
# Normally hide the option to build wiiuse on VS, since it depends
@ -29,6 +28,10 @@ else()
set(WIIUSE_BUILD ON)
endif()
if(UNIX AND NOT APPLE)
option(USE_XRANDR "Use xrandr instead of vidmode" OFF)
endif()
set(STK_SOURCE_DIR "src")
set(STK_DATA_DIR "${PROJECT_SOURCE_DIR}/data")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
@ -118,10 +121,6 @@ if(USE_FRIBIDI)
endif()
endif()
# Xrandr
if(UNIX AND USE_XRANDR)
find_package(Xrandr REQUIRED)
endif()
if(UNIX)
# if(USE_CPP2011)
@ -134,12 +133,13 @@ find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
if(UNIX AND NOT APPLE)
if(USE_XRANDR)
find_package(Xrandr REQUIRED)
else()
find_library(IRRLICHT_XF86VM_LIBRARY Xxf86vm)
mark_as_advanced(IRRLICHT_XF86VM_LIBRARY)
else()
set(IRRLICHT_XF86VM_LIBRARY "")
endif()
endif()
# Set some compiler options
@ -245,10 +245,16 @@ target_link_libraries(supertuxkart
stkirrlicht
${CURL_LIBRARIES}
${OGGVORBIS_LIBRARIES}
${IRRLICHT_XF86VM_LIBRARY}
${OPENAL_LIBRARY}
${OPENGL_LIBRARIES})
if(UNIX AND NOT APPLE)
if(USE_XRANDR)
target_link_libraries(supertuxkart ${XRANDR_LIBRARIES})
else()
target_link_libraries(supertuxkart ${IRRLICHT_XF86VM_LIBRARY})
endif()
endif()
if(APPLE)
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
@ -284,11 +290,6 @@ if(USE_WIIUSE)
endif()
# Xrandr
if(UNIX AND USE_XRANDR)
target_link_libraries(supertuxkart ${XRANDR_LIBRARIES})
endif()
if(MSVC)
target_link_libraries(supertuxkart iphlpapi.lib)
add_custom_command(TARGET supertuxkart POST_BUILD