Skip to content

Commit 5838526

Browse files
committed
[CMake] Simplify search for X11 components
Inspired by this forum post: https://root-forum.cern.ch/t/install-root-in-my-directory-in-a-share-server/60150/2
1 parent cecf4c6 commit 5838526

File tree

1 file changed

+11
-33
lines changed

1 file changed

+11
-33
lines changed

cmake/modules/SearchInstalledSoftware.cmake

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -347,39 +347,17 @@ if(x11)
347347
if(X11_X11_INCLUDE_PATH)
348348
set(X11_FIND_QUIETLY 1)
349349
endif()
350-
find_package(X11 REQUIRED)
351-
if(X11_FOUND)
352-
list(REMOVE_DUPLICATES X11_INCLUDE_DIR)
353-
if(NOT X11_FIND_QUIETLY)
354-
message(STATUS "X11_INCLUDE_DIR: ${X11_INCLUDE_DIR}")
355-
message(STATUS "X11_LIBRARIES: ${X11_LIBRARIES}")
356-
endif()
357-
else()
358-
message(FATAL_ERROR "libX11 and X11 headers must be installed.")
359-
endif()
360-
if(X11_Xpm_FOUND)
361-
if(NOT X11_FIND_QUIETLY)
362-
message(STATUS "X11_Xpm_INCLUDE_PATH: ${X11_Xpm_INCLUDE_PATH}")
363-
message(STATUS "X11_Xpm_LIB: ${X11_Xpm_LIB}")
364-
endif()
365-
else()
366-
message(FATAL_ERROR "libXpm and Xpm headers must be installed.")
367-
endif()
368-
if(X11_Xft_FOUND)
369-
if(NOT X11_FIND_QUIETLY)
370-
message(STATUS "X11_Xft_INCLUDE_PATH: ${X11_Xft_INCLUDE_PATH}")
371-
message(STATUS "X11_Xft_LIB: ${X11_Xft_LIB}")
372-
endif()
373-
else()
374-
message(FATAL_ERROR "libXft and Xft headers must be installed.")
375-
endif()
376-
if(X11_Xext_FOUND)
377-
if(NOT X11_FIND_QUIETLY)
378-
message(STATUS "X11_Xext_INCLUDE_PATH: ${X11_Xext_INCLUDE_PATH}")
379-
message(STATUS "X11_Xext_LIB: ${X11_Xext_LIB}")
380-
endif()
381-
else()
382-
message(FATAL_ERROR "libXext and Xext headers must be installed.")
350+
find_package(X11 REQUIRED COMPONENTS Xpm Xft Xext)
351+
list(REMOVE_DUPLICATES X11_INCLUDE_DIR)
352+
if(NOT X11_FIND_QUIETLY)
353+
message(STATUS "X11_INCLUDE_DIR: ${X11_INCLUDE_DIR}")
354+
message(STATUS "X11_LIBRARIES: ${X11_LIBRARIES}")
355+
message(STATUS "X11_Xpm_INCLUDE_PATH: ${X11_Xpm_INCLUDE_PATH}")
356+
message(STATUS "X11_Xpm_LIB: ${X11_Xpm_LIB}")
357+
message(STATUS "X11_Xft_INCLUDE_PATH: ${X11_Xft_INCLUDE_PATH}")
358+
message(STATUS "X11_Xft_LIB: ${X11_Xft_LIB}")
359+
message(STATUS "X11_Xext_INCLUDE_PATH: ${X11_Xext_INCLUDE_PATH}")
360+
message(STATUS "X11_Xext_LIB: ${X11_Xext_LIB}")
383361
endif()
384362
endif()
385363

0 commit comments

Comments
 (0)