From 6f8792e92238e993c24eb1742126a1e311f53efa Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Sat, 29 Feb 2020 15:16:51 -0500 Subject: [PATCH] Only include headers that we actually use and need Signed-off-by: Christophe Bedard --- tracetools/CMakeLists.txt | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/tracetools/CMakeLists.txt b/tracetools/CMakeLists.txt index 50ebc2d..a5e6387 100644 --- a/tracetools/CMakeLists.txt +++ b/tracetools/CMakeLists.txt @@ -33,26 +33,45 @@ if(NOT TRACETOOLS_DISABLED) endif() endif() -# store configuration variables for runtime use +# Store configuration variables for runtime use # TRACETOOLS_DISABLED # TRACETOOLS_LTTNG_ENABLED configure_file(include/${PROJECT_NAME}/config.h.in include/${PROJECT_NAME}/config.h) -# add both source and output include, to capture config.h -include_directories(include ${PROJECT_BINARY_DIR}/include) - # Tracetools lib set(SOURCES src/tracetools.c src/utils.cpp ) +set(HEADERS + include/${PROJECT_NAME}/tracetools.h + include/${PROJECT_NAME}/utils.hpp + include/${PROJECT_NAME}/visibility_control.hpp +) if(TRACETOOLS_LTTNG_ENABLED) + # We only need these if we're using LTTng list(APPEND SOURCES - include/tracetools/tp_call.h src/tp_call.c ) + list(APPEND HEADERS + include/${PROJECT_NAME}/tp_call.h + ) endif() +# Copy select headers to the actual include/ directory that we will use and export +foreach(_header ${HEADERS}) + configure_file( + ${PROJECT_SOURCE_DIR}/${_header} + ${PROJECT_BINARY_DIR}/${_header} + COPYONLY + ) +endforeach() + +# Only use output/binary include directory +include_directories( + ${PROJECT_BINARY_DIR}/include +) + add_library(${PROJECT_NAME} ${SOURCES}) if(TRACETOOLS_LTTNG_ENABLED) target_link_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES}) @@ -79,12 +98,8 @@ install(TARGETS ) install( - DIRECTORY include/ - DESTINATION include -) -install( - FILES ${PROJECT_BINARY_DIR}/include/${PROJECT_NAME}/config.h - DESTINATION include/${PROJECT_NAME} + DIRECTORY ${PROJECT_BINARY_DIR}/include/ + DESTINATION include/ ) install( TARGETS ${PROJECT_NAME}