]> granicus.if.org Git - graphviz/commitdiff
Fix lib/pack objs not included in lib/gvc dynamic lib for CMake builds
authorMagnus Jacobsson <magnus.jacobsson@berotec.se>
Mon, 14 Sep 2020 21:34:49 +0000 (23:34 +0200)
committerMagnus Jacobsson <magnus.jacobsson@berotec.se>
Wed, 23 Sep 2020 06:37:52 +0000 (08:37 +0200)
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 neatopack.c:

neatopack.c:(.text+0x81): undefined reference to `ccomps'

lib/gvc/CMakeLists.txt
lib/pack/CMakeLists.txt

index ed4cbab2e60d638244041ad9f2afd53792474f58..1db89a0ab87a3cfd3b5f68fb341a20f67fbce08e 100644 (file)
@@ -51,13 +51,13 @@ target_include_directories(gvc PRIVATE
 
 target_link_libraries(gvc PRIVATE
     $<TARGET_OBJECTS:common_obj>
+    $<TARGET_OBJECTS:pack_obj>
 )
 
 target_link_libraries(gvc PUBLIC
     cdt
     cgraph
     label
-    pack
     pathplan
     xdot
     ${EXPAT_LIBRARIES}
index 54dc9523a8601e6acb882700bcac20b1f79e38f1..87d6d0cc8853d530dfc8772a28e30e01eb69bf72 100644 (file)
@@ -1,6 +1,6 @@
 add_definitions(-DGVC_EXPORTS)
 
-add_library(pack STATIC
+add_library(pack_obj OBJECT
     # Header files
     pack.h
 
@@ -9,7 +9,7 @@ add_library(pack STATIC
     pack.c
 )
 
-target_include_directories(pack PRIVATE
+target_include_directories(pack_obj PRIVATE
     ${GRAPHVIZ_LIB_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${GRAPHVIZ_LIB_DIR}/cdt
@@ -20,6 +20,10 @@ target_include_directories(pack PRIVATE
     ${GRAPHVIZ_LIB_DIR}/pathplan
 )
 
+add_library(pack STATIC
+    $<TARGET_OBJECTS:pack_obj>
+)
+
 # Specify headers to be installed
 install(
     FILES pack.h