CMake: obtain list of header files used for compilation - cmake

I am trying to build a sub C project that refers to multiple headers recursively from another project, which also contains unused headers. Instead of including all the unwanted header files in target_include_directories. I want to include only the required headers.
Note: The C project's CMake Build is not 100% through. I am facing errors in few headers.
I want those intermediate build files i.e. list of header files consumed by the C sources.
Is there is anyway to obtain the list?
Related Question with GCC
list of all header files included by a C file

Related

List files and paths in a VB poject

I have several VB.Net projects each with containing many files/forms. Several of the forms are shared/linked between more than one project and saved in a shared folder. Recently I discovered one file that should have been shared was not, meaning that there were two files with the same name in two different folders. Obviously any change of a file in one project was not shown in the other poject. Is there any way of listing all the files and paths in a project - either to screen or spreadsheet?
you should take a look at the projectname.vbproj file, it is a xml file and in the node called <ItemGroup> you are going to find what you are looking for, you can tell if a file is a linked one if inside the <Compile> node there is a <Link> tag.

Translate string that are unknown at compile time

I am writing an application which has content that can be added from external sources (through a set of JSON files). Therefore the content to be displayed is mostly unknown at comile time but will be curated (no random sources).
For the content that is known at compile time I can add translations by adding the corresponding tr() guards or QT_TR_NOOPS in the sources where the external content is parsed.
Is there a way to achieve the same for strings that are unknown at compile time? I could add the text for the several translations in the JSON file and write my own code the translation. However I would prefer to have all translations in a central file and use Qt translation code. I would then update the qm file containing the translation together with the JSONs and restart the application.

aggregate target + target paths

For one of my schemes I want to copy 2 folders into the final app bundle. For that I created an aggregate target with a copy build phase and added that target to the scheme where it should be triggered. That works fine, except for the target paths.
I appears something with the target paths is wrong however. In the copy build phase I can select whatever pre defined path exists in the drop down, the folder always end up in the same place ("Myproject/DerivedData/Myproject/Build/Products/Debug") instead of the app bundle. Is there something special to consider for aggregate targets?
I also tried to set a subpath with one of the build variables. They don't seem to be set however and have no effect. Setting a manual path works however. Though, I don't want to hard code my apps bundle name + Contents etc. if the normal way is usually to use an env var.
Btw. I also tried a script phase and checked the env vars printed in the build log. None contains the path to my app bundle (or parts of it below the Debug folder).
Maybe it has to do with the target type (aggregate target), I don't know. I couldn't get the predefined paths to work, they always seem to be empty. So, I ended up by hard coding the relative path (which rarely changes). But that is of course asking for trouble if I ever change the project's name.

Java - project dependency and current\relative working directory

I have two project where one is depended on the other, i.e. project A depends on project B, and the two projects reside in different directories.
In the independent project, i.e. project B, there is a class which holds a code that tries to access directories and files with respect to independent project directory. Since the depended project, i.e. project A, instantiate an object from the independent project, when the object execute System.getProperty("user.dir") it returns the execution directory, i.e. the directory of the dependent project; the same holds for new File(".").getAbsolutePath().
I would like to solve the issue in generic way, i.e. I wish to avoid the need to pass as an argument the path, rather, I wish the use relative directories programatically.
Any guidance\clues?
P.S. not sure if it is relevant, but I am using Eclipse as my IDE.
UPDATE
This should hold...
final String clsName = getClass().getName() + ".class";
System.out.println(getClass().getResource(clsName));
I'd use the class-loader instead of using paths directly. In eclipse, and in an deployment situation both projects resources should be in the classpath.
ProjectA
example.png
ProjectB
foo.txt
Something like this should be able to load a resource from either project A or B.
URL url = getClass().getResource("/example.png"); // get URL
InputStream stream = getClass().getResource("/foo.txt").openStream(); // open a stream

Using multiple Source control folders in a single build definition TFS 2010

In the Workspace tab
Source Control Folder: I am picking only two locations from my entire team project. I do not want to pick the entire team project because it has 20 projects.
I only need two project locations for the build.
$/TeamProject/ABCProj.SVC
$/TeamProject/ABCProj.UI
Build Agent Folder, If i specify the same $(SourceDir) for both the Source control folder locations($/TeamProject/ABCProj.SVC, $/TeamProject/ABCProj.UI)
above, I am unable to save the build definition.
I am getting an error when saving the Build definition
"$(SourceDir) can only be mapped one time in a given workspace"
Can any one please suggest a solution.
You'll have to map your version control folders to different source directories, for example:
$/TeamProject/ABCProj.SVC -> $(SourceDir)/ABCProj.SVC
$/TeamProject/ABCProj.UI -> $(SourceDir)/ABCProj.UI
Alternatively, you can just map $/TeamProject to $(SourceDir) and cloak all subprojects you don't want to get the sources for.