# Linking against Catalyst... without cmake

**URL:** https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657
**Category:** In Situ Support
**Created:** [September 28, 2018, 11:22pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657 "2018-09-28T23:22:47Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [September 28, 2018, 11:22pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/1 "2018-09-28T23:22:47Z")

</div>

Hi,

All the examples I see that use Catalyst rely on cmake to do something like `find_package(ParaView ...)` and link the code against the right libraries. Typically they will rely on finding components like vtkPVPythonCatalyst and vtkParallelMPI and the cmake magic will resolve the rest.

My question is simple: how would I write “by hand” a Makefile that links a code against the right libraries to run with Catalyst? (is that only possible?)

Thanks

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.paraview.org/user_avatar/discourse.paraview.org/olesenm/32/17416_2.png) [@olesenm](https://discourse.paraview.org/u/olesenm)
#### Post date: [October 1, 2018, 12:03pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/2 "2018-10-01T12:03:55Z")

</div>

I would not attempt this myself, since the easiest workaround is to have a cmake target within your makefile.  
If you do however need this, you can use cmake locally and then attempt to filter through the makefiles that cmake generates and see how far you get with stripping down the content to hand-craft your own makefile.

---

<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: [October 1, 2018, 2:02pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/3 "2018-10-01T14:02:07Z")

</div>

There is the `paraview-config` executable which can get the required information.

For CMake-level support for this, see [this issue](https://gitlab.kitware.com/cmake/cmake/issues/17236).

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [October 1, 2018, 2:27pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/4 "2018-10-01T14:27:51Z")

</div>

@ben.boeckel Thanks, this seems to be doing what I want!

Is there a way to locate the `paraview-config` program from within a CMakeLists.txt file?  
What I mean is, after calling `find_package(ParaView ...)`, get the path to `paraview-config` to be able to call it?

My use case is that of a library compiled using CMake, which depends on Catalyst. My build process creates a .pc file for use with pkg-config from a .pc.in file configured by cmake. I would like to call `paraview-config`, get its output, and put it in the .pc file when it is generated.

Thanks

---

<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: [October 1, 2018, 3:38pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/5 "2018-10-01T15:38:53Z")

</div>

It should be a target, so something like this should work:

```auto
add_custom_command(COMMAND $<TARGET_FILE:paraview-config> ${args} > ${output_file})
# another add_custom_command to take the output file and make the `.pc` file for it.

```

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [October 1, 2018, 8:42pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/6 "2018-10-01T20:42:39Z")

</div>

Apparently when using `$<TARGET_FILE:paraview-config>`, it refers to the paraview-config located in the “lib” directory of Catalyst’s installation path. This executable is dynamically linked against other libraries, requiring me to set LD\_LIBRARY\_PATH correctly beforehand. The paraview-config executable located in the “bin” directory, however, doesn’t have this problem (no idea why). Is there a way to get the path to that executable instead?

---

<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: [October 2, 2018, 12:30pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/7 "2018-10-02T12:30:51Z")

</div>

Ooh, forward excutables strike again 😕 . On Linux, `$<TARGET_FILE:paraview-config-launcher>` should work (but just `paraview-config` on other platforms. Long-term, forward executables shouldn’t be necessary in ParaView, but that’s not the case right now. If you need it to work on multiple platforms `if (TARGET paraview-config-target)` should do the job to detect which is necessary.

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [October 2, 2018, 5:35pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/8 "2018-10-02T17:35:27Z")

</div>

Thanks, that work now. However I’m not sure paraview-config is returning the complete list of libraries needed. When trying to link a program, I get a bunch of undefined references.  
Before those undefined references error, I get things like this:

/usr/bin/ld: warning: libvtkUtilitiesPythonInitializer-pv5.6.so.1, needed by /home/mdorier/catalyst/lib/libvtkPVPythonCatalyst-pv5.6.so, not found (try using -rpath or -rpath-link)

(a bunch of other libraries are not found, like libvtkjpeg-pv5.6.so.1, etc.)

Those libraries are not output by paraview-config (yet they are available in Catalyst’s install directory).

---

<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: [October 4, 2018, 3:53pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/9 "2018-10-04T15:53:35Z")

</div>

Hmm. What is the command line you’re using?

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [October 4, 2018, 3:59pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/10 "2018-10-04T15:59:04Z")

</div>

I’m using `paraview-config --libs vtkPVPythonCatalyst vtkParallelMPI` to ge the list of required libraries.

---

<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: [October 9, 2018, 3:07pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/11 "2018-10-09T15:07:12Z")

</div>

Looking at it locally, I do see `vtkjpeg` in the list. I think the issue with the `vtkUtilitiesPythonInitializer` is that `PythonCatalyst` is an odd-ball module (i.e., it doesn’t go through `vtkModuleTop`). I think the easiest there is just just add `vtkUtilitiesPythonInitializer` to the list of modules you need.

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [October 14, 2018, 9:12pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/12 "2018-10-14T21:12:13Z")

</div>

Adding `vtkUtilitiesPythonInitializer` doesn’t improve anything (it just adds `-lvtkUtilitiesPythonInitializer-pv5.6` to the list of libraries output by paraview-config). To be precise, here is the list of libraries that are missing from the output:

libvtkInfovisCore-pv5.6  
libvtkjpeg-pv5.6  
libvtkpng-pv5.6  
libvtktiff-pv5.6  
libvtkmetaio-pv5.6  
libvtkgl2ps-pv5.6

If I set LD\_LIBRARY\_PATH to the path where they are located, I can compile my program without link error.  
Any idea what is missing?

Thanks

---

<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: [October 15, 2018, 12:57pm UTC](https://discourse.paraview.org/t/linking-against-catalyst-without-cmake/657/13 "2018-10-15T12:57:37Z")

</div>

For now, I’d just add them to the `paraview-config` line manually. With the new module system coming, `paraview-config` needs to be redone anyways since it can’t get the information it needs from CMake (due to genex stuff and other details).
