Improve detection of libXss, OpenGL and libXext DPMS support.

The detection of libXss has been changed to ask the question
"where is libXss?" before asking "is XScreenSaverQueryInfo
available?" rather than the other way around. The test for
"XScreenSaverQueryInfo" also ensures that the include and
library flags from pkg-config are used.

The OpenGL test has been amended to make use of the include
paths and library flags returned by pkg-config to prevent the
test from failing when OpenGL is not in /usr.

The libXext test in kcontrol/energy/CMakeLists.txt is amended
to use the libXext include path and library flags. The paths
are also added to the include/link directories.

Signed-off-by: aneejit1 <aneejit1@gmail.com>
(cherry picked from commit 7fba97e18a)
pull/182/head
aneejit1 4 years ago committed by Slávek Banko
parent 7567c01c2b
commit 4bbaa90f2a
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -265,11 +265,18 @@ endif( )
# xscreensaver ()
if( WITH_XSCREENSAVER )
check_library_exists( Xss XScreenSaverQueryInfo "" HAVE_XSSLIB )
if( HAVE_XSSLIB )
pkg_search_module( XSS xscrnsaver )
else( )
check_library_exists( Xext XScreenSaverQueryInfo "" HAVE_XEXT_XSS )
if( XSS_FOUND )
tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${XSS_INCLUDE_DIRS}" )
check_library_exists( Xss XScreenSaverQueryInfo "${XSS_LIBRARY_DIRS}" HAVE_XSSLIB )
tde_restore( CMAKE_REQUIRED_INCLUDES )
else( XSS_FOUND )
check_library_exists( Xss XScreenSaverQueryInfo "" HAVE_XSSLIB )
endif( XSS_FOUND )
if( NOT HAVE_XSSLIB )
check_library_exists( Xext XScreenSaverQueryInfo "${XEXT_LIBRARY_DIRS}" HAVE_XEXT_XSS )
if( HAVE_XEXT_XSS )
set( HAVE_XSSLIB 1 )
pkg_search_module( XSS xext )
@ -293,6 +300,7 @@ if( WITH_XSCREENSAVER )
You have to either specify it manually with e.g. -DXSCREENSAVER_DIR=/usr/lib/misc/xscreensaver/
or make sure that xscreensaver installed properly" )
endif( )
endif( )
@ -301,10 +309,13 @@ if( WITH_OPENGL )
pkg_search_module( GL gl )
if( GL_FOUND )
# some extra check, stricktly speaking they are not necessary
tde_save( CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_LIBRARIES ${GL_LIBRARIES} )
tde_save_and_set( CMAKE_REQUIRED_LIBRARIES ${GL_LIBRARIES} )
tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${GL_INCLUDE_DIRS}" )
tde_save_and_set( CMAKE_REQUIRED_FLAGS "${GL_LDFLAGS}" )
check_symbol_exists( glXChooseVisual "GL/glx.h" HAVE_GLXCHOOSEVISUAL )
tde_restore( CMAKE_REQUIRED_LIBRARIES )
tde_restore( CMAKE_REQUIRED_INCLUDES )
tde_restore( CMAKE_REQUIRED_FLAGS )
if( NOT HAVE_GLXCHOOSEVISUAL )
tde_message_fatal( "opengl is requested and found, but it doesn't provides glXChooseVisual() or GL/glx.h" )
endif( )

@ -16,6 +16,8 @@ if( WITH_DPMS )
include( CheckCSourceCompiles )
set( CMAKE_REQUIRED_LIBRARIES Xext )
set( CMAKE_REQUIRED_INCLUDES "${XEXT_INCLUDE_DIRS}" )
set( CMAKE_REQUIRED_FLAGS "${XEXT_LDFLAGS}" )
check_c_source_compiles("
#include <sys/types.h>
@ -45,10 +47,12 @@ include_directories(
${CMAKE_BINARY_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${XEXT_INCLUDE_DIRS}
)
link_directories(
${TQT_LIBRARY_DIRS}
${XEXT_LIBRARY_DIRS}
)
##### other data ################################
@ -60,6 +64,7 @@ install( FILES energy.desktop DESTINATION ${APPS_INSTALL_DIR}/.hidden )
tde_add_kpart( kcm_energy AUTOMOC
SOURCES energy.cpp
LINK tdeio-shared ${XEXT_LIBRARY}
LINK tdeio-shared
LINK_PRIVATE ${XEXT_LIBRARY}
DESTINATION ${PLUGIN_INSTALL_DIR}
)

Loading…
Cancel
Save