私のC++プロジェクトを構築するためにCMakeLists.txtファイルを書いています。
- libhybris.so: いくつかのエクスポートされた関数を含む共有ライブラリ。
- hybris: libhybris.so にリンクする実行可能ファイル
- libhybris.so にリンクするさまざまな共有ライブラリのセット
問題は、libhybris.so が (正規表現機能のために) libpcre に依存しているため、次のステートメントがあることです。
# libhybris.so generation
add_library( libhybris
SHARED
${LIB_SOURCES} )
...
# Needed libraries
target_link_libraries( libhybris
dl
pcre
pthread
readline )
そして、ポイント 3 の共有ライブラリの 1 つは pcre.so と呼ばれているため、次のものもあります。
add_library( pcre SHARED ${PCRE_SOURCES} )
...
target_link_libraries( pcre
dl
pcre
curl
pthread
readline
ffi
libhybris )
したがって、「cmake .」を実行すると、次のエラーが発生します。
-- 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.
CMake は libhybris.so pcre 依存関係 (システム libpcre.so) が私の pcre.so と同じであると考えているため、明らかにそうではありません。
pcre.so 名を変更せずにこの問題を解決するにはどうすればよいですか?