⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 292286 in webkit


Ignore:
Timestamp:
Apr 4, 2022, 4:17:51 AM (4 years ago)
Author:
Adrian Perez de Castro
Message:

[CMake] Provide better messages when gi-docgen cannot be found
https://bugs.webkit.org/show_bug.cgi?id=238729

Reviewed by Carlos Garcia Campos.

When gi-docgen cannot be found, or cannot be executed, provide better error messages
than those provided by CMake. While at it, make the messages mention how gi-docgen
can be installed inside the WebKit source tree to be used for the build.

  • Source/cmake/FindGIDocgen.cmake:
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r292285 r292286  
     12022-04-04  Adrian Perez de Castro  <aperez@igalia.com>
     2
     3        [CMake] Provide better messages when gi-docgen cannot be found
     4        https://bugs.webkit.org/show_bug.cgi?id=238729
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        When gi-docgen cannot be found, or cannot be executed, provide better error messages
     9        than those provided by CMake. While at it, make the messages mention how gi-docgen
     10        can be installed inside the WebKit source tree to be used for the build.
     11
     12        * Source/cmake/FindGIDocgen.cmake:
     13
    1142022-04-04  Miguel Gomez  <magomez@igalia.com>
    215
  • trunk/Source/cmake/FindGIDocgen.cmake

    r292263 r292286  
    7070          "${CMAKE_SOURCE_DIR}/gi-docgen"
    7171    DOC "Path to the gi-docgen program"
    72     REQUIRED
    7372)
    7473
    75 execute_process(
    76     COMMAND ${GIDocgen_EXE} --version
    77     OUTPUT_VARIABLE GIDocgen_VERSION
    78     OUTPUT_STRIP_TRAILING_WHITESPACE
    79     COMMAND_ERROR_IS_FATAL ANY
    80     ERROR_QUIET
    81 )
     74
     75if (GIDocgen_FIND_REQUIRED)
     76    set(_GIDocgen_MSGLEVEL FATAL_ERROR)
     77else ()
     78    set(_GIDocgen_MSGLEVEL WARNING)
     79endif ()
     80
     81if (NOT GIDocgen_EXE)
     82    message(${_GIDocgen_MSGLEVEL}
     83        "Could not find gi-docgen. If your system does not provide a package "
     84        "the following commands can be used to install it inside the WebKit "
     85        "source tree, where it will be found automatically:\n"
     86        "  virtualenv gi-docgen ${CMAKE_SOURCE_DIR}/gi-docgen\n"
     87        "  ${CMAKE_SOURCE_DIR}/gi-docgen/bin/pip install gi-docgen\n"
     88        "Another option is unpacking a gi-docgen release at the same location "
     89        "but in this case dependencies will not be automatically installed.\n"
     90    )
     91elseif (GIDocgen_EXE)
     92    execute_process(
     93        COMMAND ${GIDocgen_EXE} --version
     94        OUTPUT_VARIABLE GIDocgen_VERSION
     95        OUTPUT_STRIP_TRAILING_WHITESPACE
     96        RESULT_VARIABLE _GIDocgen_CMDSTATUS
     97        ERROR_QUIET
     98    )
     99    set(GIDocgen_VERSION "${GIDocgen_VERSION}" CACHE INTERNAL "")
     100    if (NOT ${_GIDocgen_CMDSTATUS} EQUAL 0)
     101        message(${_GIDocgen_MSGLEVEL}
     102            "Could not execute ${GIDocgen_EXE}. This typically signals an "
     103            "incorrect installation. You may want to run it by hand for "
     104            "troubleshooting, the re-run CMake again.\n"
     105        )
     106    endif ()
     107endif ()
    82108
    83109include(FindPackageHandleStandardArgs)
    84110find_package_handle_standard_args(GIDocgen
    85111    FOUND_VAR GIDocgen_FOUND
    86     REQUIRED_VARS GIDocgen_EXE
     112    REQUIRED_VARS GIDocgen_EXE GIDocgen_VERSION
    87113    VERSION_VAR GIDocgen_VERSION
    88114)
Note: See TracChangeset for help on using the changeset viewer.