Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Does VAX Add Include work with CMake projects?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tony.riviere
Ketchup Master

France
57 Posts

Posted - Feb 15 2024 :  04:00:07 AM  Show Profile  Reply with Quote
Hello,
I was wondering if this feature was compatible with CMake project. Here I have a simple solution with 2 projects: CMakeProject2 depending on CMakeProject1. When I hit "Add Include" on Class1 (defined in CMakeProject1) from CMakeProject2, VAX includes the corresponding header relatively from the current project instead of relatively to the include directory '.' of the CMakeProject1. While IntelliSense resolve the correct path.

// CMakeProject2.cpp

// #include "../CMakeProject1/CMakeProject1.h" // Generated by VAX
// #include <CMakeProject1.h>                  // Generated by Intellisense

int main()
{
    Class1 c;
    return 0;
}






I'm not using the last VAX version because the AddInclude in broken (as mentioned in another issue). Here is my info:

License: Named Network User / Standard (3DAL-VRDTCF-5U79FL-32PD) Support ends 2024.07.21
VA_X64.dll file version 10.9.2508.0 built 2023.11.24
DevEnv.exe version 17.10.34607.79 Professional
msenv.dll version 17.0.34606.254
Comctl32.dll version 6.10.22621.2506
Windows 11 11.0 23H2 Build 22631
16 processors (x86-64)
Language info: 1252, 0x40c

Platform: Win32
Stable Includes:

Other Includes:

Stable Source Directories:

feline
Whole Tomato Software

United Kingdom
18744 Posts

Posted - Feb 15 2024 :  09:10:34 AM  Show Profile  Reply with Quote
Would it be possible to get a copy of these two cmake projects so I can test this here, and run some experiments?

It sounds like VA is picking up a different understanding of the include directories than the IDE has, and I am not sure why that would happen. There is a known problem that VA doesn't currently understand external include directories, which can be generated by cmake when cmake is used to generate a Visual Studio solution. So it is possible this is the cause of the problem. Or something else could be going on here.

If it is possible to get the files please send me them via the email:

[email protected]

including this thread ID or URL in the description, so we can match it up.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18744 Posts

Posted - Feb 16 2024 :  09:09:25 AM  Show Profile  Reply with Quote
I have the test project, many thanks for this. As you already know, this is a pure CMake project, so no Visual Studio project for us to read, to get the include directories from.

VA doesn't currently pick up the include directories from "CMakeLists.txt" files, which is the problem here. This is something we are looking to do:

case=140829

Not quite as simple as picking up visual studio project settings, since as I understand it, we have to search the directory tree for multiple "CMakeLists.txt" files and correctly combine them together. So having a clear start point example is helpful, thank you for that.

zen is the art of being at one with the two'ness
Go to Top of Page

tony.riviere
Ketchup Master

France
57 Posts

Posted - Feb 16 2024 :  09:49:08 AM  Show Profile  Reply with Quote
Thank you for your quick answer.
We are moving our code base from vcxproj based to CMake based and AddInclude is definitely one of the most used feature after code navigation (since IntelliSense is completely lost on projects bigger than hello world ).
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18744 Posts

Posted - Feb 16 2024 :  11:25:08 AM  Show Profile  Reply with Quote
But surely no one really needs a project bigger than Hello World, do they?

Since you are working with larger projects, do you know about the ".vscode\settings.json" file? VA will detect and respect this file, easily letting you exclude directories and files, especially useful for excluding build files, or some auto generated files you don't want VA to parse.

zen is the art of being at one with the two'ness
Go to Top of Page

tony.riviere
Ketchup Master

France
57 Posts

Posted - Feb 19 2024 :  05:06:02 AM  Show Profile  Reply with Quote
Thanks for the hint. I was not aware of this option, and it could definitely help me the last time VSCode burnt my RAM up to 20 Go parsing the compilation directory with preprocessed sources...

Edit: In your snippet engine, we used to have snippets using the PROJECT_NAME which no longer work for the CMake project. Do you have plan to support it (or something like TARGET_NAME)?

Edited by - tony.riviere on Feb 19 2024 05:27:04 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18744 Posts

Posted - Feb 19 2024 :  11:14:23 AM  Show Profile  Reply with Quote
For excluding things, here is the content of my test file. Starting in the base directory, that you open when going open directory, it is the file:

.vscode\settings.json

and it excludes directories and files. Anything that isn't a file name is a directory being excluded.

{
    "files.exclude": {
        "*/cpp_dll_cpp17": true,
        "cpp_dll_cpp20" : true,
        "**/bugs" : true,
        "**/code_formatting_tests/clangFormatBase" : true,
        "**/test_plain_text.txt" : true,
        "**/*.xaml" : true
    }
}

this should get you up and running without to many problems with this. Please do note that you need to Enable the setting:

VA Options -> Performance -> Do not parse files excluded by .vscode\settings.json (requires restart)

before the file is going to start taking effect.


As for snippets, unfortunately no, but that is a good point. Trying the current reserved strings, $SOLUTION_NAME$ is giving me the full path of the directory I open when I open the CMake project. How close is this to what you are looking for?

Or is the target possibly different to the directory name? I still only know a tiny, and random, bit about CMake projects, so this might be a silly question.

zen is the art of being at one with the two'ness
Go to Top of Page

tony.riviere
Ketchup Master

France
57 Posts

Posted - Feb 19 2024 :  3:34:58 PM  Show Profile  Reply with Quote
The main example I have in mind is this one:

#include "$PROJECT_NAME$/$PROJECT_NAME$Defines.h"

// Expanded to: #include "ProjectA/ProjectADefines.h"

We use it at the beginning of every header of a project, as the xxxDefines.h header contains macros for this particular project (like the declspec import/export ones). And we have several projects per solution.
In case of CMake project, $PROJECT_NAME$ is expanded either to empty string in the configure has not yet been executed, or to "CMakeList" if there was a configure.

$PROJECT_PATH$ is probably the closest as it gives the full path to the folder containing the CMakeLists.txt.
// Suppose the CMake project: D:\Solution\ProjectA\CMakeLists.txt
// Then $PROJECT_PATH$ is expanded to:
D:\Solution\ProjectA

Where a macro $PROJECT_FOLDER_NAME$ could be resolved to "ProjectA" and it could work for either .vcxproj or CMakeLists.txt
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18744 Posts

Posted - Feb 20 2024 :  07:34:45 AM  Show Profile  Reply with Quote
That makes sense, so taking the directory holding the CMakeLists.txt file is considered reliable for the name of the project? I just expected you to be after something inside the CMakeLists.txt file is all

zen is the art of being at one with the two'ness
Go to Top of Page

tony.riviere
Ketchup Master

France
57 Posts

Posted - Feb 21 2024 :  07:08:33 AM  Show Profile  Reply with Quote
Well, in my case, the folder containing the CMakeLists.txt has the name of the project. But it's probably not the same for everyone.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18744 Posts

Posted - Feb 26 2024 :  09:57:21 AM  Show Profile  Reply with Quote
There is a project variable you can find in CMakeLists.txt:

https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_NAME.html

which opens up a separate conversation.

A reserved string for the directory name makes sense, I have put in a feature request for this:

case=164231

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000