From: Ivan Maidanski Date: Wed, 19 Jun 2019 22:01:30 +0000 (+0300) Subject: Build gc_cpp.cc as gccpp library by CMake script X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39c58aed0007a897edfc1c7d570860c827d47a53;p=gc Build gc_cpp.cc as gccpp library by CMake script 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. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bc3f556..59b4915d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,10 +249,6 @@ if (enable_single_obj_compilation OR BUILD_SHARED_LIBS) 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() @@ -261,6 +257,11 @@ endif() 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}) @@ -350,7 +351,7 @@ if (build_tests) 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()