# CMakeLists.txt for Catalyst 5.8

**URL:** https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434
**Category:** In Situ Support
**Created:** [January 28, 2020, 1:53pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434 "2020-01-28T13:53:24Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [January 28, 2020, 1:53pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/1 "2020-01-28T13:53:24Z")

</div>

I’m working with @joeh to instrument a code with Catalyst and we’re having a tough time writing the CMakeLists.txt for the adapter for ParaView master (almost v5.8). I have something that’s working on my machine for the `Fortran90FullExample` but when Joe tries the same CMakeLists.txt he has a lot of linking issues so I’m guessing I’m not doing something correctly. My CMakeLists.txt is:

```auto
cmake_minimum_required(VERSION 3.14)
# C isn't stricly necessary for the project but it helps
# with finding the C MPI library
project(Fortran90FullExample Fortran CXX C)
find_package(MPI)

find_package(ParaView CONFIG COMPONENTS Catalyst PythonCatalyst)
if(NOT ParaView_FOUND)
  message("cannot find paraview")
  return()
endif()

add_executable(Fortran90FullExample
  FECxxAdaptor.cxx
  FEDriver.f90
  FEFortranAdaptor.f90)

target_link_libraries(Fortran90FullExample
  PRIVATE
    ${ParaView_LIBRARIES} ${VTK_LIBRARIES}
    MPI::MPI_Fortran)
set_property(TARGET Fortran90FullExample
  PROPERTY
    LINKER_LANGUAGE Fortran)

```

I looked at the ParaView Catalyst Guide for 5.8 and Section 3.7 still has the old way, i.e. ParaView 5.6 and earlier, for doing things. What’s the correct way to do this now?

As a side note, the guide also has the old editions stuff still in there and should also be updated.

Thanks,  
Andy

---

<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: [January 28, 2020, 2:05pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/2 "2020-01-28T14:05:54Z")

</div>

> [@Andy\_Bauer](#):
>
> `${ParaView_LIBRARIES} ${VTK_LIBRARIES}`

Use `ParaView::Catalyst` and `ParaView::PythonCatalyst` here. You should also list the VTK modules you need explicitly.

> [@Andy\_Bauer](#):
>
> I looked at the ParaView Catalyst Guide for 5.8 and Section 3.7 still has the old way, i.e. ParaView 5.6 and earlier, for doing things. What’s the correct way to do this now?

There are docs in the repository. I guess they probably need updated for “normal” usage migration patterns (they just document plugin migration for now).

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [January 28, 2020, 2:19pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/3 "2020-01-28T14:19:21Z")

</div>

Ok, here’s what I changed it to:

```auto
cmake_minimum_required(VERSION 3.14)
# C isn't stricly necessary for the project but it helps
# with finding the C MPI library
project(Fortran90FullExample Fortran CXX C)
find_package(MPI)

find_package(ParaView CONFIG COMPONENTS Catalyst PythonCatalyst)
if(NOT ParaView_FOUND)
  message("cannot find paraview")
  return()
endif()

add_executable(Fortran90FullExample
  FECxxAdaptor.cxx
  FEDriver.f90
  FEFortranAdaptor.f90)

target_link_libraries(Fortran90FullExample
  PRIVATE
    ParaView::Catalyst ParaView::PythonCatalyst VTK::CommonDataModel
    MPI::MPI_Fortran)
set_property(TARGET Fortran90FullExample
  PROPERTY
    LINKER_LANGUAGE Fortran)

```

I probably don’t need quite that high of a CMake minimum version but that’s the version I’m using on my machine.

---

<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: [January 28, 2020, 2:34pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/4 "2020-01-28T14:34:14Z")

</div>

It looks good to me. Does that work? 🙂

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [January 28, 2020, 2:42pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/5 "2020-01-28T14:42:37Z")

</div>

Yep, it’s working for me. I’ll check with @joeh though since my version was working before for me as well but wasn’t working for him on his machine.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [January 29, 2020, 6:04pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/6 "2020-01-29T18:04:13Z")

</div>

@joeh says that this works for him with Python 2 on a Onyx@ERDC for master right now but it is having trouble finding Python 3. Should that be the case?

---

<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: [January 31, 2020, 3:42pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/7 "2020-01-31T15:42:25Z")

</div>

It should be if Python 3 isn’t installed on the machine 🙂 . Is it? We need headers as well, so the `-dev` or `-devel` package is needed too. It should say why it can’t find Python 3 (as in what bits are missing), so that output would be helpful.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [January 31, 2020, 3:55pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/8 "2020-01-31T15:55:49Z")

</div>

Well, ParaView was built fine with Python 3. It was just the Catalyst example that was having issues finding Python 3, if I remember what @joeh said. And by finding Python 3 I mean I think it was a linking issue and not a CMake configure issue, but again I’m just guessing here as much as you are since I didn’t see the error.

---

<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: [January 31, 2020, 4:15pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/9 "2020-01-31T16:15:11Z")

</div>

Oh. Try the `VTK_OPTIONAL_PYTHON_LINK` flag if your deployment isn’t going to be “Python-flexible” and only use the one that was built against.

---

<div class="post-metadata">

### Author: ![joeh](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@joeh](https://discourse.paraview.org/u/joeh)
#### Post date: [January 31, 2020, 4:20pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/10 "2020-01-31T16:20:36Z")

</div>

I was having problems with the CMake configuration for the Catalyst example not finding Python3 even though the ParaView superbuild was made with Python3, and even though the Python2 variant worked it did not use the one from the superbuild again instead it used the one from the system. So it is correct to think that if the system had Python3 installed in the default location it might have worked, but why can it not use the version of Python2 or Python3 that the superbuild built the ParaView 5.8.0 git master with.

Thanks,

Joe

---

<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: [January 31, 2020, 4:44pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/11 "2020-01-31T16:44:22Z")

</div>

Is it VTK/ParaView finding Python3 that fails or is it the project finding Python3 on its own that fails?

---

<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: [January 31, 2020, 4:44pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/12 "2020-01-31T16:44:59Z")

</div>

If the latter, is it doing `find_package(PythonX)` or the `find_package(PythonInterp)` and `find_package(PythonLibs)` pair?

---

<div class="post-metadata">

### Author: ![joeh](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@joeh](https://discourse.paraview.org/u/joeh)
#### Post date: [January 31, 2020, 5:52pm UTC](https://discourse.paraview.org/t/cmakelists-txt-for-catalyst-5-8/3434/13 "2020-01-31T17:52:34Z")

</div>

it is this code that is failing to find Python3

`cmake\_minimum\_required(VERSION 3.14)  
project(Fortran90FullExample Fortran CXX C)  
find\_package(MPI)

find\_package(ParaView CONFIG COMPONENTS Catalyst PythonCatalyst)  
if(NOT ParaView\_FOUND)  
message(“cannot find paraview”)  
return()  
endif()

add\_executable(Fortran90FullExample  
FECxxAdaptor.cxx  
FEDriver.f90  
FEFortranAdaptor.f90)

target\_link\_libraries(Fortran90FullExample  
PRIVATE  
ParaView::Catalyst ParaView::PythonCatalyst VTK::CommonDataModel  
MPI::MPI\_Fortran)  
set\_property(TARGET Fortran90FullExample  
PROPERTY  
LINKER\_LANGUAGE Fortran)  
`
