[cmake-developers] ExternalProject can't have interface library as a dependency

Andrey Pokrovskiy wonder.mice at gmail.com
Tue Apr 21 03:34:11 EDT 2015


[Moved from cmake users mailing list]

I have the following construction:

ExternalProject_Add(
        websockets_ep
        DEPENDS ev openssl
        ...)

But it so happened, that "openssl" is an INTERFACE library. It is an
INTERFACE library, because I created it with add_library(openssl
INTEFACE) and then populated corresponding INCLUDE and LINK
properties. And I get an obscure error:

CMake Error at /usr/share/cmake/share/cmake-3.2/Modules/ExternalProject.cmake:2031
(get_property):
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "_EP_IS_EXTERNAL_PROJECT" is not allowed.
Call Stack (most recent call first):
  /usr/share/cmake/share/cmake-3.2/Modules/ExternalProject.cmake:2328
(_ep_add_configure_command)
  src/libwebsockets/CMakeLists.txt:21 (ExternalProject_Add)

Apparently because there is a check inside get_property() that
whitelists what properties could be queried.

My first idea was that having a whitelist for get_property() is
probably not that good idea.
But then I realized that I don't understand why ExternalProject cares
about whether dependency is also an external project. What the
difference it makes? Does that means that it's not safe to use
external project target with add_dependencies()?

ExternalProject_Add() already have code that should cover all cases:

  # Depend on other external projects (target-level).
  get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
  foreach(arg IN LISTS deps)
    add_dependencies(${name} ${arg})
  endforeach()

Why there is a special case when dependency is also an external project?


More information about the cmake-developers mailing list