From 416f5ea7235b8c9d493a46be7a41ca857508b544 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 4 Jun 2019 09:38:33 +0200 Subject: [PATCH] Add include location tolerance and stop forcing _GNU_SOURCE. _GNU_SOURCE will still be enabled if building static or shared library, but only as a PRIVATE compile definition. It will not leak into targets using miniz. --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6bb333..c115fd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,8 +64,11 @@ if(AMALGAMATE_SOURCES) file(WRITE ${CMAKE_BINARY_DIR}/amalgamation/miniz.h "${AMAL_MINIZ_H}") add_library(${PROJECT_NAME} INTERFACE) - target_compile_definitions(${PROJECT_NAME} - INTERFACE $<$:_GNU_SOURCE>) + # Might not be a good idea to force this on the library user + # as it could bloat the global namespace + # https://github.com/libevent/libevent/issues/460 + # target_compile_definitions(${PROJECT_NAME} + # INTERFACE $<$:_GNU_SOURCE>) set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES @@ -131,7 +134,8 @@ install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib - INCLUDES DESTINATION include + # users can use or + INCLUDES DESTINATION include include/${PROJECT_NAME} ) include(CMakePackageConfigHelpers)