]> granicus.if.org Git - gc/commitdiff
Support header files installation in CMake script
authorVictor Romero <romerosanchezv@gmail.com>
Fri, 7 Jun 2019 06:34:27 +0000 (09:34 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 7 Jun 2019 06:34:27 +0000 (09:34 +0300)
Issue #281 (bdwgc).

Now, "cmake --target install" copies the public header files (to the
installation destination) unless -Dinstall_headers=OFF is passed to
cmake.

* CMakeLists.txt (install_headers): New option (on by default).
* CMakeLists.txt [install_headers] (include/gc.h, include/gc_backptr.h,
include/gc_config_macros.h, include/gc_gcj.h, include/gc_inline.h,
include/gc_mark.h, include/gc_pthread_redirects.h,
include/gc_tiny_fl.h, include/gc_typed.h, include/gc_version.h,
include/javaxfc.h, include/leak_detector.h): Specify install to
"include/gc" folder.
* CMakeLists.txt [install_headers && enable_cplusplus]
(include/gc_allocator.h, include/gc_cpp.h): Likewise.
* CMakeLists.txt [install_headers && enable_disclaim]
(include/gc_disclaim.h): Likewise.
* CMakeLists.txt [install_headers] (include/extra/gc.h): Specify
install to "include" folder.
* CMakeLists.txt [install_headers && enable_cplusplus]
(include/extra/gc_cpp.h): Likewise.

CMakeLists.txt

index 4175e07a0e919e4a52680088a7eda1374724e918..f70041d3fa11dc7913217b797bc8cc7e3d672e7a 100644 (file)
@@ -50,6 +50,7 @@ option(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON)
 option(enable_register_main_static_data "Perform the initial guess of data root sets" ON)
 option(enable_checksums "Report erroneously cleared dirty bits" OFF)
 option(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON)
+option(install_headers "Install header files" ON)
 
 add_definitions("-DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION")
 
@@ -260,6 +261,33 @@ if (build_cord)
   add_subdirectory(cord)
 endif()
 
+if (install_headers)
+  install(FILES include/gc.h
+                include/gc_backptr.h
+                include/gc_config_macros.h
+                include/gc_gcj.h
+                include/gc_inline.h
+                include/gc_mark.h
+                include/gc_pthread_redirects.h
+                include/gc_tiny_fl.h
+                include/gc_typed.h
+                include/gc_version.h
+                include/javaxfc.h
+                include/leak_detector.h
+          DESTINATION include/gc)
+  install(FILES include/extra/gc.h DESTINATION include)
+  if (enable_cplusplus)
+    install(FILES include/gc_allocator.h
+                  include/gc_cpp.h
+            DESTINATION include/gc)
+    install(FILES include/extra/gc_cpp.h DESTINATION include)
+  endif(enable_cplusplus)
+  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()
+
 if (build_tests)
   add_subdirectory(tests)
 endif()