# Cmake error when building a ParaView plugin (external library linking)

**URL:** https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849
**Category:** ParaView Support
**Created:** [June 14, 2024, 9:51am UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849 "2024-06-14T09:51:52Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 14, 2024, 9:51am UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/1 "2024-06-14T09:51:52Z")

</div>

Hello,

I’m writing a C+±based ParaView plugin and found a strange cmake error at generate step.

To reproduce the problem I’m facing, let’s start from a example (e.g. [GitHub - jfavre/ParaViewSalvusPlugin: A C++ plugin for ParaView to read Salvus HDF5 data](https://github.com/jfavre/ParaViewSalvusPlugin)). It builds fine.

Then if I simply add a `target_link_libraries` to library Kokkos, in src/Reader/CMakeLists.txt as shown here:

> <https://github.com/jfavre/ParaViewSalvusPlugin/commit/66b862e6cf1686d7e01be7d495e398a36f4416ba>

cmake complains with following error message (see below).  
What is strange to me is that actually, the Makefiles are well generated; and if I add some code that actually uses Kokkos API, it builds and runs fine; but still this cmake error at generate step persists. I don’t know how to remove it.  
I also tried (just for cross-checking) linking to other external third party libraries. It works fine. So I guess there may be something special when linking a paraview plugin to kokkos library ? I don’t know how to investigate that. And again, despite the error message, the plugin can still build ok.

Any help appreciated.

========================================================================  
– Found MPI: TRUE (found version “3.1”) found components: C  
– Found MPI: TRUE (found version “3.1”)  
– Enabled Kokkos devices: OPENMP  
– Configuring done  
CMake Error in src/CMakeLists.txt:  
Evaluation file to be written multiple times with different content. This  
is generally caused by the content evaluating the configuration type,  
language, or location of object files:

/home/kestenerp/install/visualization/paraview/github/ParaViewSalvusPlugin-pk/\_build/src/CMakeFiles/SalvusHDF5Reader-client-server.Release.args

CMake Error in src/Reader/CMakeLists.txt:  
Evaluation file to be written multiple times with different content. This  
is generally caused by the content evaluating the configuration type,  
language, or location of object files:

/home/kestenerp/install/visualization/paraview/github/ParaViewSalvusPlugin-pk/\_build/src/Reader/CMakeFiles/SalvusHDF5Reader-hierarchy.Release.args

– Generating done  
CMake Generate step failed. Build files cannot be regenerated correctly.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [June 14, 2024, 1:09pm UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/2 "2024-06-14T13:09:19Z")

</div>

Your plugin is named the same as the post-`::` part of a module. Rename one of them and it should be fine.

---

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 14, 2024, 6:36pm UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/3 "2024-06-14T18:36:14Z")

</div>

Ok, I see now. Thanks.

---

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 17, 2024, 6:12pm UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/4 "2024-06-17T18:12:48Z")

</div>

I’ve renamed the module, I’ve also modified CMakeLists.txt that builds the module to use `vtk_module_find_package(PACKAGE Kokkos)` to detect external library. But still the error at generate step is still there and I don’t understand why.

Is there a way to debug the cmake generate step ?

---

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 18, 2024, 7:16am UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/5 "2024-06-18T07:16:37Z")

</div>

Hello,

Let me just take another example directly from Paraview sources, subfolder `Examples/Plugins/LagrangianIntegrationModel`

It builds fine.  
Just for illustrating the problem, if I add those lines:

```auto
vtk_module_find_package(
  PACKAGE Kokkos
  )
vtk_module_link(LagrangianExample PRIVATE Kokkos::kokkos)

```

then the same cmake (from generator) comes again:

```auto
CMake Error in Plugin/CMakeLists.txt:
  Evaluation file to be written multiple times with different content. This
  is generally caused by the content evaluating the configuration type,
  language, or location of object files:

   /home/kestenerp/install/visualization/paraview/github/ParaView/Examples/Plugins/LagrangianIntegrationModel/_build/Plugin/CMakeFiles/LagrangianExample-client-server..args

CMake Error in Plugin/LagrangianExample/CMakeLists.txt:
  Evaluation file to be written multiple times with different content. This
  is generally caused by the content evaluating the configuration type,
  language, or location of object files:

   /home/kestenerp/install/visualization/paraview/github/ParaView/Examples/Plugins/LagrangianIntegrationModel/_build/Plugin/LagrangianExample/CMakeFiles/LagrangianExample-hierarchy..args

```

Again, despite the cmake error, the build is ok.

There is obviously something that I didn’t understand about linking a plugin module to an external library.  
Can someone help ?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [June 19, 2024, 12:03pm UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/6 "2024-06-19T12:03:36Z")

</div>

That is certainly weird… I notice the `..args` in the paths which seems like you have an empty string configuration value? Can you provide the target definition of `Kokkos::kokkos`?

---

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 19, 2024, 3:59pm UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/7 "2024-06-19T15:59:27Z")

</div>

About `..args` : the log above was generated without `CMAKE_BUILD_TYPE`; when add a build type, it doesn’t change the error message.

Regarding the definition of target `Kokkos::kokkos`, looking at KokkosTargets.cmake in install directory, one can see:

```auto
# Create imported target Kokkos::kokkos
add_library(Kokkos::kokkos INTERFACE IMPORTED)

set_target_properties(Kokkos::kokkos PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "Kokkos::kokkoscore;Kokkos::kokkoscontainers;Kokkos::kokkosalgorithms;Kokkos::kokkossimd"
)

```

all the other `Kokkos::` targets are either SHARED or INTERFACE IMPORTED libraries.  
I can provide the entire file if needed. Anything particular should be noticed ? One can also see that Kokkos is linking to libdl, could this be a problem (for whatever reason) ?

Is there a way to trace inside cmake to understand how the error is generated ?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [June 19, 2024, 6:04pm UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/8 "2024-06-19T18:04:57Z")

</div>

Yes. Run `cmake --trace-expand` (and redirect stderr to a file). Searching for the problematic paths should find where they’re being called from.

---

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 20, 2024, 9:26am UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/9 "2024-06-20T09:26:48Z")

</div>

Hello,

I’ve recompiled cmake just to make the error message clearer (and print the difference when conflict happens).

I found the origin of the conflict when generating those files (e.g. `LagrangianExample-client-server..args`). They are generated for language C and CXX and Kokkos is adding symbol `KOKKOS_DEPENDENCE` for CXX for compile and link (that’s the difference):

```auto
set_target_properties(Kokkos::kokkoscore PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "\$<\$<COMPILE_LANGUAGE:CXX>:KOKKOS_DEPENDENCE>"
  INTERFACE_COMPILE_FEATURES "cxx_std_17"
  INTERFACE_COMPILE_OPTIONS "\$<\$<COMPILE_LANGUAGE:CXX>:>"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "Kokkos::HWLOC;Kokkos::LIBDL;OpenMP::OpenMP_CXX"
  INTERFACE_LINK_OPTIONS "\$<\$<LINK_LANGUAGE:CXX>:-DKOKKOS_DEPENDENCE>"
) 

```

This symbol is used by kokkos; when compiling, kokkos actually uses `kokkos_launch_compiler` to redirect to the actual c++ compiler/linker when needed (e.g. when compiling for Nvidia/Cuda). I’m only using Kokkos::OpenMP backend, but this symbol is always defined for language CXX (and not for C).

I don’t quite understand why this problem only happens now, only when building a paraview plugin.  
Is is really necessary to generate those files for C language ? Maybe, that is the root cause of the problem ?

Any suggestion on how to fix that ?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [June 21, 2024, 11:10am UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/10 "2024-06-21T11:10:13Z")

</div>

> [@pkestene](#):
>
> I don’t quite understand why this problem only happens now, only when building a paraview plugin.  
> Is is really necessary to generate those files for C language ? Maybe, that is the root cause of the problem ?

Seems to be the case. I’m not sure what makes it get generated per-language though… Is there only the one `file(GENERATE)` call that mentions this path as an `OUTPUT` or are there multiple instances in the `--trace-expand` log?

---

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 21, 2024, 1:01pm UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/11 "2024-06-21T13:01:14Z")

</div>

yes, there is only one call to `file(GENERATE)`  
and I noticed that **every occurence** of `file(GENERATE)` leads to 2 calls to `cmGeneratorExpressionEvaluationFile::Generate`, one for C language, one for CXX language.

There error message above correspond to the two occurences where C and CXX generated file disagree.  
In my case, the file that is actually used finaly is the one generated using lang=C, the second time, the error message is displayed. So I think there is something wrong, it means if the third party c++ library is defining compilation flags specific for CXX, they will be ignored when building the plugin.

The `file(GENERATE)` calls that are causing problem are the ones coming from paraview’s :

- vtkModule.cmake in function `_vtk_module_write_wrap_hierarchy`
- vtkModuleWrapClientServer.cmake in function `_vtk_module_wrap_client_server_sources`

Would it be a solution to modify the calls to `file(GENERATE)` at those locations by adding `CONDITION <expression>` where condition would be true only for lang=CXX (since anyway the plugin is written in CXX) ?

---

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 5, 2025, 9:29am UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/12 "2025-06-05T09:29:45Z")

</div>

I’m still seeing this error at cmake generate stage when trying to build a Paraview plugin that links with a C++ library.

Despite the cmake error, the generated file are usable, I can build my plugin that is ok.

But still this error (as summarized just above in previous message) makes me think there is a problem because cmake is trying to generate multiple times the files (once for C, once for CXX) but I would expect to be generated only for CXX (as the plugin is a CXX cmake project)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [June 13, 2025, 10:13am UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/13 "2025-06-13T10:13:54Z")

</div>

I agree there’s a problem here. Can you please [file an issue](https://gitlab.kitware.com/paraview/paraview/-/issues) so that it doesn’t get lost?

---

<div class="post-metadata">

### Author: ![pkestene](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pkestene/32/12850_2.png) [@pkestene](https://discourse.paraview.org/u/pkestene)
#### Post date: [June 17, 2025, 11:29am UTC](https://discourse.paraview.org/t/cmake-error-when-building-a-paraview-plugin-external-library-linking/14849/14 "2025-06-17T11:29:04Z")

</div>

Ok, thanks. I’ll do that shortly and provide a minimalist reproducer if it can help analysis.
