ExternalProject_Add + autotools

I have this CMakeLists.txt file. The goal of this CMakeLists.txt is simply to have a shared library that contain all libass dependencies.

To do so, we use libass-cmake. It build libass and it’s dependencies. Here is how we build libass which use autotools: libass-cmake/cmake/ass.cmake at 68729805da3fa71ae566bd350b336d7b683b4c83 · peerless2012/libass-cmake · GitHub

In the CMakeLists.txt, we have 3 hacks:

  1. We copied libass header in our project
  2. We need to specify all libass dependencies manually in target_link_libraries.
  3. We created a empty file (Ass.c), so we can create our shared library:

I wanted to use pkg_search_module, but the problem is that is look for the .pc file before we actually build libass in libass-cmake, so it seems we cannot use it.

How can i remove the hacks we have in our project?