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). forcedInclude (optional) A list of files that should be included before any other characters in the source file are processed. 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. set the appropriate INSTALLRPATH property of executables and shared libraries instead of CMake. 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. source files need to be generatedCmake Install Rpath Convert. 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. Some properties need to be set in order to add include directories and tell CMake where this. For our usage, we create targets at the top of a directory hierarchy, and then in subdirectories add files to that target. source file, use the CMake setsourcefilesproperties command. 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. As a consequence, only this file is copied. Properties in CMake are values that are attached to a specific object or scope of CMake, such as a file, target, directory, or test case. The problem is that the PUBLICHEADER property is set to the 1st file only, instead of a list of 3 files (comma separated string). Setting this property for a file means this file will be compiled, unless HEADERFILEONLY is set. C++), C, CSharp, CUDA, Fortran, HIP, ISPC, and ASM. If it is not set the language is determined based on the file extension. In the fix for that issue, the specific use case of the GENERATED property was addressed but not the general issue. In addition, a 3rd header file includes the 2 others for simplicity of use. A property that can be set to indicate what programming language the source file is. By default, source file properties are only visible to targets added in the same directory ( CMakeLists.txt ). This was described in some detail in the replies to issue #18399 (closed). Sets properties associated with source files using a key/value paired list.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |