Skip to content

Commit

Permalink
Support header files installation in CMake script
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vicroms authored and ivmai committed Jun 7, 2019
1 parent 6cc171b commit 97b9fd6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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()

0 comments on commit 97b9fd6

Please sign in to comment.