Help Rewriting kdepim/akonadi/agents/nie/CMakeLists.txt

Brad King brad.king at kitware.com
Thu Jul 24 00:00:41 CEST 2008


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.  You can run nepomuk-rcgen during the cmake
configuration step with execute_process, but that will run every time
and not have dependencies.  You can use the cmake try_compile() command
to update a whole build tree during the configuration step.

Can you summarize what this program does and the relationships of its
input/output files and the resulting library to be built?

-Brad


More information about the Kde-buildsystem mailing list