D15002: Allow to install syntax files instead of having them in a resource

Kevin Funk noreply at phabricator.kde.org
Tue Oct 23 23:27:40 BST 2018

kfunk added inline comments.


> CMakeLists.txt:3
>  macro(generate_php_syntax_definition targetFile srcFile)
> -    add_custom_command(
> -        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${targetFile}
> -        COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generators/generate-php.pl < ${CMAKE_CURRENT_SOURCE_DIR}/syntax/${srcFile} > ${CMAKE_CURRENT_BINARY_DIR}/${targetFile}
> -        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generators/generate-php.pl ${CMAKE_CURRENT_SOURCE_DIR}/syntax/${srcFile}
> -    )
> +    execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/syntax)
> +    execute_process(COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generators/generate-php.pl

Note: The Ninja generator doesn't like this:

  CMake Warning (dev):
    Policy CMP0058 is not set: Ninja requires custom command byproducts to be
    explicit.  Run "cmake --help-policy CMP0058" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.
    This project specifies custom command DEPENDS on files in the build tree
    that are not specified as the OUTPUT or BYPRODUCTS of any
    add_custom_command or add_custom_target:
    For compatibility with versions of CMake that did not have the BYPRODUCTS
    option, CMake is generating phony rules for such files to convince 'ninja'
    to build.
    Project authors should add the missing BYPRODUCTS or OUTPUT options to the
    custom commands that produce these files.
  This warning is for project developers.  Use -Wno-dev to suppress it.

There must be a way to implement this feature and keep using `add_custom_command`...? Using `execute_process()` is usually a bad sign (tm). Note that these commands will be executed each CMake run(!)

  R216 Syntax Highlighting


To: cullmann, vkrause, dhaumann
Cc: kfunk, dhaumann, kwrite-devel, kde-frameworks-devel, michaelh, ngraham, bruns, demsking, cullmann, sars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20181023/e2e508a5/attachment.html>

More information about the KWrite-Devel mailing list