From 7fba97e18aa453c76130f587740f692cd267a216 Mon Sep 17 00:00:00 2001 From: aneejit1 Date: Wed, 17 Jun 2020 21:45:21 +0000 Subject: 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 --- ConfigureChecks.cmake | 25 ++++++++++++++++++------- kcontrol/energy/CMakeLists.txt | 7 ++++++- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 1e38dd672..64908c9da 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -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 ) + pkg_search_module( XSS xscrnsaver ) + + 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( ) diff --git a/kcontrol/energy/CMakeLists.txt b/kcontrol/energy/CMakeLists.txt index 9e194602a..b9f2f9958 100644 --- a/kcontrol/energy/CMakeLists.txt +++ b/kcontrol/energy/CMakeLists.txt @@ -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 @@ -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} ) -- cgit v1.2.1