![]() Header file processing At configuration time, a list of header files that should be scanned by AUTOMOC is computed from the targets sources. ![]() In some cases we can work around this by making an OBJECT library in the subdirectory and linking that to the main target, but that gets challenging if the compilation environment required is not easy to extract or re-specify (for example the top-level target links against multiple libraries with complex conditions that we should not have to reproduce in the subdirectory). When this property is set ON, CMake will scan the header and source files at build time and invoke moc accordingly. If you enable setting the property in the toplevel file set_source_files_properties/src/CMakeLists.txt then the property works fine and takes effect but if you set it in the subdirectory in set_source_files_properties/src/subdir/CMakeLists.txt it does not. Here is a contrived example demonstrating the issue I am talking about in detail. We do not do this often, but it sometimes comes up during development to allow compile-time selection of experimental features based on option settings. However, this means that we cannot specify per-source file properties in those locations - we have to go up to the top level of the hierarchy to set those. This keeps the names of source files close to the CMakeLists.txt file for them. For our usage, we create targets at the top of a directory hierarchy, and then in subdirectories add files to that target. I realize this issue is discussed in the documentation with the line "Source file properties are visible only to targets added in the same directory", but I think this is an issue that affects the ability to modularize a project and it would be valuable to address it in a general manner. addlibrary 3.1 addlibrary( STATIC SHARED MODULE EXCLUDEFROMALL source1 source2.auxsourcedirectory : SRCLIST auxsourcedirectory (. In the fix for that issue, the specific use case of the GENERATED property was addressed but not the general issue. cmakeminimumrequired (VERSION 3.4.1) cmake 2. ![]() This was described in some detail in the replies to issue #18399 (closed). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |