# The Zen of integrating 3rd party packages

**URL:** https://discourse.cmake.org/t/the-zen-of-integrating-3rd-party-packages/1318
**Category:** Code
**Created:** [June 3, 2020, 11:08pm UTC](https://discourse.cmake.org/t/the-zen-of-integrating-3rd-party-packages/1318 "2020-06-03T23:08:19Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![jwm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jwm/32/654_2.png) [@jwm](https://discourse.cmake.org/u/jwm)
#### Post date: [June 6, 2020, 12:27am UTC](https://discourse.cmake.org/t/the-zen-of-integrating-3rd-party-packages/1318/2 "2020-06-06T00:27:35Z")

</div>

So I guess Zen will have to wait. As my favorite fortune cookie says,

> _Pragmatics must take precedence over elegance, for Nature is not impressed._

I was trying to avoid actually installing this project, because that’s kind of destructive. Everything else I’ve built in CMake, I can just use within my project. But, since I’m building in a Docker container, I can tolerate it, and the project must move forward.

This got me working:

```cmake
include(ExternalProject)

# MPSSE
ExternalProject_Add(mpsse
  DOWNLOAD_DIR mpsse
  SOURCE_DIR mpsse/libmpsse-1.3/src
  INSTALL_DIR /usr/local

  # download step
  DOWNLOAD_COMMAND unzip -u ${CMAKE_CURRENT_SOURCE_DIR}/libmpsse-1.3.zip

  # configure step
  CONFIGURE_COMMAND <SOURCE_DIR>/configure --disable-python --prefix <INSTALL_DIR> --libdir <INSTALL_DIR>/lib64

  # build step
  BUILD_IN_SOURCE 1
  BUILD_COMMAND make
)

```

I had to explicitly do the **unzip** because if I just pass a URL, CMake insists on adding intervening directories in the \<SOURCE\_DIR\> path. With the explicit **unzip** I had more control. The challenge with this particular build is that the zipfile has an enclosing directory that has **doc** and **src** subdirectories. I couldn’t figure out how to get **configure** to run in the same directory it is in. When I controlled \<SOURCE\_DIR\>, it worked.

I’d like to understand the proper way to expose the products of this build for CMake, but I think in the long run, I’ll be better off just writing a CMake file for it. It’s a trivial project and that would probably have been less work than this has cost me.

---

_[View the full topic](https://discourse.cmake.org/t/the-zen-of-integrating-3rd-party-packages/1318)._
