]> granicus.if.org Git - gc/commitdiff
Build libcord by CMake script
authorIvan Maidanski <ivmai@mail.ru>
Wed, 19 Jun 2019 08:48:40 +0000 (11:48 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 19 Jun 2019 09:29:39 +0000 (12:29 +0300)
Issue #281 (bdwgc).

* CMakeLists.txt [build_cord] (CORD_SRC): Set variable.
* CMakeLists.txt [build_cord] (cord): Specify add_library and
target_link_libraries; remove TODO.
* CMakeLists.txt [install_headers && build_cord] (cord/cord.h,
cord/cord_pos.h, cord/ec.h): Specify install.
* CMakeLists.txt [build_tests && build_cord] (cordtest, de): Do not
compile cord/cordbscs.c, cord/cordprnt.c, cord/cordxtra.c; add cord to
target_link_libraries specification.

CMakeLists.txt

index 86424dfeee82a579b475dead044a4028a1c64d33..c0df95f6a137fb998650aafdbff7132cab17323e 100644 (file)
@@ -261,7 +261,11 @@ endif()
 
 add_library(gc ${SRC})
 
-# TODO if build_cord then add_library(cord ...)
+if (build_cord)
+  set(CORD_SRC cord/cordbscs.c cord/cordprnt.c cord/cordxtra.c)
+  add_library(cord ${CORD_SRC})
+  target_link_libraries(cord PRIVATE gc)
+endif()
 
 if (install_headers)
   install(FILES include/gc.h
@@ -283,25 +287,28 @@ if (install_headers)
                   include/gc_cpp.h
             DESTINATION include/gc)
     install(FILES include/extra/gc_cpp.h DESTINATION include)
-  endif(enable_cplusplus)
+  endif()
   if (enable_disclaim)
     install(FILES include/gc_disclaim.h DESTINATION include/gc)
-  endif(enable_disclaim)
-  # TODO if build_cord then install cord.h, cord_pos.h, ec.h
-endif()
+  endif()
+  if (build_cord)
+    install(FILES include/cord.h
+                  include/cord_pos.h
+                  include/ec.h
+            DESTINATION include/gc)
+  endif()
+endif(install_headers)
 
 if (build_tests)
   if (build_cord)
-    add_executable(cordtest cord/cordbscs.c cord/cordprnt.c cord/cordxtra.c
-                   cord/tests/cordtest.c)
-    target_link_libraries(cordtest PRIVATE gc)
+    add_executable(cordtest cord/tests/cordtest.c)
+    target_link_libraries(cordtest PRIVATE cord gc)
     add_test(NAME cordtest COMMAND cordtest)
 
     if (WIN32)
-      add_executable(de cord/cordbscs.c cord/cordxtra.c
-                     cord/tests/de.c cord/tests/de_win.c)
+      add_executable(de cord/tests/de.c cord/tests/de_win.c)
       set_target_properties(de PROPERTIES WIN32_EXECUTABLE TRUE)
-      target_link_libraries(de PRIVATE gc gdi32)
+      target_link_libraries(de PRIVATE cord gc gdi32)
     endif()
   endif(build_cord)