Rename libgc-lib.a to libgc.a in CMake script
authorVictor Romero <romerosanchezv@gmail.com>
Sat, 15 Jun 2019 10:52:08 +0000 (13:52 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 15 Jun 2019 10:52:08 +0000 (13:52 +0300)
Issue #281 (bdwgc).

Also specify that libgc.a is used privately in test executables.

* CMakeLists.txt (gc-lib): Rename library to gc in add_library and
set_target_properties.
* cord/CMakeLists.txt [build_tests] (cordtest, de): Rename gc-lib to gc
and add PRIVATE in target_link_libraries.
* tests/CMakeLists.txt (gctest, hugetest, leaktest, middletest,
realloc_test, smashtest): Likewise.
* tests/CMakeLists.txt [enable_gc_debug] (tracetest): Likewise.
* tests/CMakeLists.txt [enable_disclaim] (disclaim_bench,
disclaim_test, disclaim_weakmap_test): Likewise.

CMakeLists.txt
cord/CMakeLists.txt
tests/CMakeLists.txt

index b8ced02..6e4b10a 100644 (file)
@@ -259,8 +259,8 @@ if (enable_cplusplus)
   set(SRC ${SRC} gc_cpp.cc)
 endif()
 
-add_library(gc-lib STATIC ${SRC})
-set_target_properties(gc-lib PROPERTIES
+add_library(gc STATIC ${SRC})
+set_target_properties(gc PROPERTIES
                       COMPILE_DEFINITIONS GC_NOT_DLL)
 #TODO TARGET_LINK_LIBRARIES(...  ...  ${LIBS})
 
index a0a8a7b..50290c9 100644 (file)
@@ -17,7 +17,7 @@ if (build_tests)
   add_executable(cordtest cordbscs.c cordprnt.c cordxtra.c
                  tests/cordtest.c)
   set_target_properties(cordtest PROPERTIES COMPILE_DEFINITIONS GC_NOT_DLL)
-  target_link_libraries(cordtest gc-lib)
+  target_link_libraries(cordtest PRIVATE gc)
   add_test(NAME cordtest COMMAND cordtest)
 
   if (WIN32)
@@ -25,7 +25,6 @@ if (build_tests)
                    tests/de.c tests/de_win.c)
     set_target_properties(de PROPERTIES WIN32_EXECUTABLE TRUE)
     set_target_properties(de PROPERTIES COMPILE_DEFINITIONS GC_NOT_DLL)
-    target_link_libraries(de gc-lib)
-    target_link_libraries(de gdi32)
+    target_link_libraries(de PRIVATE gc gdi32)
   endif(WIN32)
 endif()
index c6bcc7d..33bc370 100644 (file)
@@ -23,51 +23,51 @@ if (enable_cplusplus)
 endif()
 
 add_executable(gctest WIN32 test.c)
-target_link_libraries(gctest gc-lib)
+target_link_libraries(gctest PRIVATE gc)
 add_test(NAME gctest COMMAND gctest)
 
 add_executable(hugetest huge_test.c)
-target_link_libraries(hugetest gc-lib)
+target_link_libraries(hugetest PRIVATE gc)
 add_test(NAME hugetest COMMAND hugetest)
 
 add_executable(leaktest leak_test.c)
-target_link_libraries(leaktest gc-lib)
+target_link_libraries(leaktest PRIVATE gc)
 add_test(NAME leaktest COMMAND leaktest)
 
 add_executable(middletest middle.c)
-target_link_libraries(middletest gc-lib)
+target_link_libraries(middletest PRIVATE gc)
 add_test(NAME middletest COMMAND middletest)
 
 add_executable(realloc_test realloc_test.c)
-target_link_libraries(realloc_test gc-lib)
+target_link_libraries(realloc_test PRIVATE gc)
 add_test(NAME realloc_test COMMAND realloc_test)
 
 add_executable(smashtest smash_test.c)
-target_link_libraries(smashtest gc-lib)
+target_link_libraries(smashtest PRIVATE gc)
 add_test(NAME smashtest COMMAND smashtest)
 
 if (enable_gc_debug)
   add_executable(tracetest trace_test.c)
-  target_link_libraries(tracetest gc-lib)
+  target_link_libraries(tracetest PRIVATE gc)
   add_test(NAME tracetest COMMAND tracetest)
 endif()
 
 if (enable_cplusplus)
   # TODO add_executable(test_cpp test_cpp.cc)
-  # target_link_libraries(test_cpp gc-lib)
+  # target_link_libraries(test_cpp PRIVATE gc)
   # add_test(NAME test_cpp COMMAND test_cpp)
 endif()
 
 if (enable_disclaim)
   add_executable(disclaim_bench disclaim_bench.c)
-  target_link_libraries(disclaim_bench gc-lib)
+  target_link_libraries(disclaim_bench PRIVATE gc)
   add_test(NAME disclaim_bench COMMAND disclaim_bench)
 
   add_executable(disclaim_test disclaim_test.c)
-  target_link_libraries(disclaim_test gc-lib)
+  target_link_libraries(disclaim_test PRIVATE gc)
   add_test(NAME disclaim_test COMMAND disclaim_test)
 
   add_executable(disclaim_weakmap_test disclaim_weakmap_test.c)
-  target_link_libraries(disclaim_weakmap_test gc-lib)
+  target_link_libraries(disclaim_weakmap_test PRIVATE gc)
   add_test(NAME disclaim_weakmap_test COMMAND disclaim_weakmap_test)
 endif()