(edited the subject) > Did you check these? > https://cmake.org/cmake/help/v3.10/command/target_include_directories.html > https://cmake.org/cmake/help/v3.10/command/target_sources.html Yes I’m very well aware of those commands, but they do not achieve what I described, as it populates target properties, not source file properties. Also target_sources can only be used to conditionally link targets or propagate source files needed for target that links the library (such as .natvis files), which is not what I want here.
Bests, Lectem De : Jano Svitok Envoyé le :samedi 2 décembre 2017 13:38 À : Lectem Cc : cmake-developers@cmake.org Objet :Re: [cmake-developers] (no subject) On Sat, Dec 2, 2017 at 10:45 AM, Lectem <lec...@gmail.com> wrote: Hi, I’m hurting an issue trying to hide dependencies from files that do not need those. For example, I have a library that helps me decode some file, but I don’t want this library headers to be available for every .cpp in my library but one. For example what one may do is the following : #--------------------- add_library(mylib foo.cpp bar.cpp) target_link_libraries(mylib PRIVATE libonlyusefulforfoo) #--------------------- It works fine, but now bar.cpp can also include headers from libonlyusefulforfoo. So what I tried was to use object libraries, but it has many disadvantages : • I now have to duplicate dependencies for the object library and mylib if they have include directories requirements or compile flags in common • An object library is a target… and I don’t want to add one target per file that has special include directories • An object library shows in IDEs, while I’d like the .cpp files to stay in the same project. In visual the obj will be in my library but this is not practical. I thought about source files properties, but unfortunately they do not support include directories, so here is my question : TL ;DR Would it be possible/difficult to have a PRIVATE_INCLUDE_DIRECTORIES property added for source files ? We already have COMPILE_FLAGS so why not include directories ? I know we can set include directories per directory, but I don’t think that putting single .cpp files in seperate headers is good. Thanks, Lectem Did you check these? https://cmake.org/cmake/help/v3.10/command/target_include_directories.html https://cmake.org/cmake/help/v3.10/command/target_sources.html Jano
-- 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