The following issue has been SUBMITTED. ====================================================================== https://cmake.org/Bug/view.php?id=16102 ====================================================================== Reported By: pboettch Assigned To: ====================================================================== Project: CMake Issue ID: 16102 Category: CMake Reproducibility: always Severity: major Priority: normal Status: new ====================================================================== Date Submitted: 2016-05-12 18:09 EDT Last Modified: 2016-05-12 18:09 EDT ====================================================================== Summary: target_include_directories behaves differently on STATIC and SHARED libraries Description: Consider the following CMakeLists.txt:
add_library(lib1 INTERFACE) target_include_directories(lib1 INTERFACE /lib1-dir) add_library(lib3 STATIC src3.c) target_include_directories(lib3 PUBLIC /lib3-dir) target_link_libraries(lib3 PRIVATE lib1) add_executable(exe1 exe.c) target_link_libraries(exe1 lib3) Here lib3 is privately linking with lib1. However, during the compilation of exe.c I see -I/lib1-dir is passed to gcc. When creating lib3 as a SHARED library it works as expected. I understand that lib1 needs to be linked to exe1 if lib3 is STATIC and that this not necessary when lib3 is SHARED. However this logic does not apply for include_directories (or compile-definitions and compile-options), which should, IMHO, never be passed on if link is PRIVATE. Hence this bug-report. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2016-05-12 18:09 pboettch New Issue ====================================================================== -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers