views:

91

answers:

1

Hi guys, i have the following problem. I'm writing a CMakeLists.txt to build a C++ project of mine, which is composed of

  1. libhybris.so : A shared library with some exported functions.
  2. hybris : An executable which links to libhybris.so
  3. A set of various shared libraries which links to libhybris.so

The problem is that, libhybris.so depends on libpcre (for regexp capabilities), so i have the following statements :

# libhybris.so generation
add_library( libhybris 
             SHARED 
             ${LIB_SOURCES} )

...

# Needed libraries
target_link_libraries( libhybris 
                       dl 
                       pcre 
                       pthread
                       readline )

And one of the shared libraries from point 3, is called pcre.so, so i have the following too :

add_library( pcre SHARED ${PCRE_SOURCES} )

...

target_link_libraries( pcre
                       dl 
                       pcre 
                       curl
                       pthread
                       readline
                       ffi 
                       libhybris )

So, when i run a "cmake ." i have the following error :

-- Configuring done
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
  "libhybris" of type SHARED_LIBRARY
    depends on "pcre"
  "pcre" of type SHARED_LIBRARY
    depends on "libhybris"
At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.

Because cmake thinks that the libhybris.so pcre dependency (system libpcre.so) is the same of my pcre.so which is not obviously.

How can i solve this problem without changing pcre.so name ?

A: 

Depends on your development environments, you can set build path to over come this difficulties.

Ankiov Spetsnaz
If i don't set the name explicitly (giving the full path of libhybris.so for instance) cmake will not recognize libhybris.so as a dependency of pcre.so, i've already tried that.
Simone Margaritelli