Hello, what would be the recommended approach in CMake to implement the so-called pattern rules as known in Make:
For example, the source files *.stub.php
are used to generate the _arginfo.h
files with PHP.
A follow up question:
- Would an unknown language extension in
add_library()
,add_executable()
ortarget_sources()
cause any issues in CMake somewhere?
For example:
add_library(foo)
target_sources(foo PRIVATE foo.c bar.c foo.stub.php)
Because, I was aiming a bit to add the CMakeDeterminePHPCompiler
, CMakePHPInformation
and other files to use enable_language(PHP)
but the main issue is still figuring out proper dependency relations between the C objects in the linked library and the *.stub.php
files. For example, the *_arginfo.h
files from their accompanying *.stub.php
files in the context of the library should be generated before compiling C files as they include the *_arginfo.h
files.
I’m guessing that using CMakeDeterminePHPCompiler
for generating files would be a bit of a cheating as there wouldn’t be any compilation here specifically, only generation.
And adding add_custom_command()
gets a bit heavy IMHO in the build output phase and there comes an issue of retrieving the source files from either library source directory or the library target sources a bit.
Any suggestion is most welcome. Thank you.