Wrap interface include directories with BUILD_INTERFACE generator expression (#966)
* Wrap interface include directories with BUILD_INTERFACE generator expression
When exporting a CMake target using install(TARGETS) + install(EXPORT),
CMake requires all include directories to be clean of build system
directories.
https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.html
This change also allows use of brotli as a CMake subproject and
installing + exporting it.
* Fix typo in generator expression
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 983e839..e86b13b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -197,7 +197,7 @@
if(NOT BROTLI_EMSCRIPTEN)
set_target_properties(${lib} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
endif()
- set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIRS}")
+ set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${BROTLI_INCLUDE_DIRS}>")
endforeach()
if(NOT BROTLI_EMSCRIPTEN)