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
-- 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