----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/112151/#review39310 -----------------------------------------------------------
find-modules/FindXCB.cmake <http://git.reviewboard.kde.org/r/112151/#comment28983> If I don't specify any components, what should happen? Currently there is a fatal error from cmake and several warnings from pkg-config. find-modules/FindXCB.cmake <http://git.reviewboard.kde.org/r/112151/#comment28981> Typo. Should be ${_header}. Otherwise you're not actually looking for the file specified above. Note that the xcb/ part here should be removed because it is already part of the _header variable set above. Either remove it here, or remove it N times above. find-modules/FindXCB.cmake <http://git.reviewboard.kde.org/r/112151/#comment28979> This is printing the message even if the component is not found. find-modules/FindXCB.cmake <http://git.reviewboard.kde.org/r/112151/#comment28984> Should only be appended if defined. find-modules/FindXCB.cmake <http://git.reviewboard.kde.org/r/112151/#comment28982> If XCB_INCLUDE_DIRS is not defined you get a fatal error from CMake here. It would not be defined if I do this: # I don't have xcb-ewmh-dev on my system. find_package(XCB OPTIONAL_COMPONENTS EWMH) Wrap this in if(XCB_INCLUDE_DIRS) Here's a diff fixing the issues: diff --git a/find-modules/FindXCB.cmake b/find-modules/FindXCB.cmake index 2684ed0..823d167 100644 --- a/find-modules/FindXCB.cmake +++ b/find-modules/FindXCB.cmake @@ -60,9 +60,15 @@ unset(unknownComponents) set(pkgConfigModules) set(requiredComponents) +if (XCB_FIND_COMPONENTS) + set(comps ${XCB_FIND_COMPONENTS}) +else() + set(comps ${knownComponents}) +endif() + # iterate through the list of requested components, and check that we know them all. # If not, fail. -foreach(comp ${XCB_FIND_COMPONENTS}) +foreach(comp ${comps}) list(FIND knownComponents ${comp} index ) if("${index}" STREQUAL "-1") list(APPEND unknownComponents "${comp}") @@ -183,16 +189,17 @@ macro(_XCB_HANDLE_COMPONENT _comp) set(_lib "xcb-xv") endif() - find_path(XCB_${_comp}_INCLUDE_DIR NAMES xcb/${header} HINTS ${PKG_XCB_INCLUDE_DIRS}) + find_path(XCB_${_comp}_INCLUDE_DIR NAMES ${_header} HINTS ${PKG_XCB_INCLUDE_DIRS}) find_library(XCB_${_comp}_LIBRARY NAMES ${_lib} HINTS ${PKG_XCB_LIBRARY_DIRS}) - if(NOT XCB_FIND_QUIETLY) - message(STATUS "XCB[${_comp}]: Found component ${_comp}") + if(XCB_${_comp}_INCLUDE_DIR AND XCB_${_comp}_LIBRARY) + list(APPEND XCB_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR}) + list(APPEND XCB_LIBRARIES ${XCB_${_comp}_LIBRARY}) + if (NOT XCB_FIND_QUIETLY) + message(STATUS "XCB[${_comp}]: Found component ${_comp}") + endif() endif() - list(APPEND XCB_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR}) - list(APPEND XCB_LIBRARIES ${XCB_${_comp}_LIBRARY}) - if(XCB_FIND_REQUIRED_${_comp}) list(APPEND requiredComponents XCB_${_comp}_FOUND) endif() @@ -210,16 +217,18 @@ IF (NOT WIN32) include(FindPackageHandleStandardArgs) # Use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls - FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PKG_XCB QUIET ${pkgConfigModules}) + find_package(PkgConfig) + pkg_check_modules(PKG_XCB QUIET ${pkgConfigModules}) - SET(XCB_DEFINITIONS ${PKG_XCB_CFLAGS}) + set(XCB_DEFINITIONS ${PKG_XCB_CFLAGS}) - foreach(comp ${XCB_FIND_COMPONENTS}) + foreach(comp ${comps}) _xcb_handle_component(${comp}) endforeach() - list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS) + if(XCB_INCLUDE_DIRS) + list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS) + endif() find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS ${requiredComponents}) - Stephen Kelly On Sept. 4, 2013, 4:57 a.m., Martin Gräßlin wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://git.reviewboard.kde.org/r/112151/ > ----------------------------------------------------------- > > (Updated Sept. 4, 2013, 4:57 a.m.) > > > Review request for KDE Frameworks, Alexander Neundorf and Stephen Kelly. > > > Description > ------- > > Instead of finding all or nothing from XCB it becomes components aware. So a > user can just specify which XCB components it needs and compilation doesn't > fail if a not-needed unrelated component is not found. It also allows to have > some components as required and some as optional. > > > Diffs > ----- > > find-modules/FindXCB.cmake 7e7e701 > > Diff: http://git.reviewboard.kde.org/r/112151/diff/ > > > Testing > ------- > > tested in kde-workspace > > > Thanks, > > Martin Gräßlin > >
_______________________________________________ Kde-frameworks-devel mailing list Kde-frameworks-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-frameworks-devel