From: Magnus Jacobsson Date: Mon, 14 Sep 2020 13:18:42 +0000 (+0200) Subject: Fix lib/common objs not included in lib/gvc lib for CMake builds X-Git-Tag: 2.46.0~20^2^2~68^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=354ed2c644452f300b316d166386bd40d8fec76f;p=graphviz Fix lib/common objs not included in lib/gvc lib for CMake builds This is what the autotools builds do. For some reason this was not a problem on Windows. Without this, the rtest/test_examples.py gave errors like this for e.g. demo.c: demo.c:(.text+0x29): undefined reference to `gvParseArgs' --- diff --git a/lib/common/CMakeLists.txt b/lib/common/CMakeLists.txt index b96b3e99d..75918df5f 100644 --- a/lib/common/CMakeLists.txt +++ b/lib/common/CMakeLists.txt @@ -49,7 +49,7 @@ add_custom_command( >> ${CMAKE_CURRENT_BINARY_DIR}/ps_font_equiv.h ) -add_library(common STATIC +add_library(common_obj OBJECT # Header files arith.h color.h @@ -105,7 +105,7 @@ add_library(common STATIC ${BISON_HTMLparse_OUTPUTS} ) -target_include_directories(common PRIVATE +target_include_directories(common_obj PRIVATE ${GRAPHVIZ_LIB_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} @@ -120,14 +120,18 @@ target_include_directories(common PRIVATE ) if (WIN32) - target_include_directories(common PRIVATE ${WINDOWS_DEPENDENCY_DIR}/include) + target_include_directories(common_obj PRIVATE ${WINDOWS_DEPENDENCY_DIR}/include) endif() # From https://gitlab.com/graphviz/graphviz/-/issues/1613 @mdwies 20093010 if(APPLE) - target_compile_options(common PRIVATE "-fno-common") + target_compile_options(common_obj PRIVATE "-fno-common") endif(APPLE) +add_library(common STATIC + $ +) + # Specify headers to be installed install( FILES diff --git a/lib/gvc/CMakeLists.txt b/lib/gvc/CMakeLists.txt index 156cceafd..ed4cbab2e 100644 --- a/lib/gvc/CMakeLists.txt +++ b/lib/gvc/CMakeLists.txt @@ -49,10 +49,13 @@ target_include_directories(gvc PRIVATE ${RxSpencer_INCLUDE_DIRS} ) -target_link_libraries(gvc +target_link_libraries(gvc PRIVATE + $ +) + +target_link_libraries(gvc PUBLIC cdt cgraph - common label pack pathplan @@ -64,11 +67,11 @@ target_link_libraries(gvc ) if (NOT WIN32) - target_link_libraries(gvc ${LTDL_LIBRARIES}) + target_link_libraries(gvc PUBLIC ${LTDL_LIBRARIES}) endif() if (${with_ortho}) - target_link_libraries(gvc ortho) + target_link_libraries(gvc PUBLIC ortho) endif() # Installation location of library files