Issue #281 (bdwgc).
This matches the behavior of the Automake-based build script.
* CMakeLists.txt [enable_cplusplus] (SRC): Do not add gc_cpp.cc.
* CMakeLists.txt [enable_cplusplus] (gccpp): Specify add_library and
target_link_libraries.
* CMakeLists.txt [build_tests && enable_cplusplus] (test_cpp): Add gccpp
to target_link_libraries.
endif(CMAKE_USE_PTHREADS_INIT)
endif()
-if (enable_cplusplus)
- set(SRC ${SRC} gc_cpp.cc)
-endif()
-
if (BUILD_SHARED_LIBS)
add_definitions("-DGC_DLL")
else()
add_library(gc ${SRC})
+if (enable_cplusplus)
+ add_library(gccpp gc_cpp.cc)
+ target_link_libraries(gccpp PRIVATE gc)
+endif()
+
if (build_cord)
set(CORD_SRC cord/cordbscs.c cord/cordprnt.c cord/cordxtra.c)
add_library(cord ${CORD_SRC})
if (enable_cplusplus)
add_executable(test_cpp WIN32 tests/test_cpp.cc)
- target_link_libraries(test_cpp PRIVATE gc)
+ target_link_libraries(test_cpp PRIVATE gc gccpp)
add_test(NAME test_cpp COMMAND test_cpp)
endif()