From e44a81d3f4d7c2993d659cbd655be023e523ffc7 Mon Sep 17 00:00:00 2001 From: JosiahWI <41302989+JosiahWI@users.noreply.github.com> Date: Sun, 27 Aug 2023 01:07:23 -0500 Subject: [PATCH] Fix public usage requirements on CMake targets (#462) This adds the include directory to the public includes for both the static and shared targets. It is necessary to do it for both the build and install interfaces, because the build interface will be used if the project is added as a submodule, but the install interface will be used if the project was added using a config. Fixes #460. Co-authored-by: Jung-Sang Ahn --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4516b9ef..c936a41c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,6 +278,20 @@ set_target_properties(static_lib PROPERTIES OUTPUT_NAME ${LIBRARY_NAME} CLEAN_DI add_library(shared_lib SHARED ${STATIC_LIB_SRC}) add_library(NuRaft::shared_lib ALIAS shared_lib) set_target_properties(shared_lib PROPERTIES OUTPUT_NAME ${LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1) + +# Include directories are necessary for dependents to use the targets. +target_include_directories(static_lib + PUBLIC + $ + $ +) + +target_include_directories(static_lib + PUBLIC + $ + $ +) + if (APPLE) target_link_libraries(shared_lib ${LIBRARIES}) endif ()