diff --git a/CMakeLists.txt b/CMakeLists.txt index 966c5efe6..23d20b86a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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,13 +133,14 @@ find_package(OpenGL REQUIRED) include_directories(${OPENGL_INCLUDE_DIR}) if(UNIX AND NOT APPLE) - find_library(IRRLICHT_XF86VM_LIBRARY Xxf86vm) - mark_as_advanced(IRRLICHT_XF86VM_LIBRARY) -else() - set(IRRLICHT_XF86VM_LIBRARY "") + if(USE_XRANDR) + find_package(Xrandr REQUIRED) + else() + find_library(IRRLICHT_XF86VM_LIBRARY Xxf86vm) + mark_as_advanced(IRRLICHT_XF86VM_LIBRARY) + endif() endif() - # Set some compiler options if(UNIX) @@ -153,12 +153,12 @@ if(WIN32) # And shut up about unsafe stuff add_definitions(-D_CRT_SECURE_NO_WARNINGS) - # VS will automatically add NDEBUG for release mode, but only _DEBUG in debug mode. - # Since STK uses DEBUG, this is added for debug compilation only: + # VS will automatically add NDEBUG for release mode, but only _DEBUG in debug mode. + # Since STK uses DEBUG, this is added for debug compilation only: set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG) else() # All non VS generators used create only a single compile mode, so - # compile flags can be simplye be added + # compile flags can be simplye be added if(CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-DDEBUG) else() @@ -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