Help Rewriting kdepim/akonadi/agents/nie/CMakeLists.txt
Allen Winter
winter at kde.org
Thu Jul 24 00:11:57 CEST 2008
On Wednesday 23 July 2008 18:00:41 Brad King wrote:
> Allen Winter wrote:
> > I need help from the CMake Gurus.
> >
> > Attached is my attempt at rewriting kdepim/akonadi/agents/nie/CMakeLists.txt.
> >
> > The problem is: the nepomuk-rcgen program creates a file that contains a list
> > of source files to compile into the nie library.
> >
> > So you'll notice that I read the contents of the file into a variable and attempt
> > to use that in kde4_add_library(). But CMake complains that the input files
> > don't exist.
> >
> > I'm lost.
>
> This looks like you have an add_custom_command and expect the output to
> be available for file(READ) on the next line of the CMakeLists.txt file.
> Remember that add_custom_command creates a rule that is evaluated at
> *build* time which is after *cmake* time. The file(READ) takes place
> during cmake time, so the custom command has not yet been executed.
>
> You cannot have something that runs at build time generate a list of
> files to be used during the same build. All the build rules have to be
> generated ahead of time.
>
Right, that's exactly what I'm experiencing.
> You can run nepomuk-rcgen during the cmake configuration step with
> execute_process, but that will run every time and not have dependencies.
>
That's the current situation and what I'm trying to change.
> You can use the cmake try_compile() command
> to update a whole build tree during the configuration step.
>
Most likely not what I want.
>
> Can you summarize what this program does and the relationships of its
> input/output files and the resulting library to be built?
>
AFAIK, nepomuk-rcgen generates C++ source files and headers, along
with a list of files that it created. It is passed a set of rules and input
files to figure out what it needs to create.
So.. the file(READ...) is trying to read the list of files nepomuk-rcgen generated.
Then we try to build a static library using that list of files.
Hope this is clearer.
More information about the Kde-buildsystem
mailing list