Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add external library and add_subdirectory to project tree #194

Open
ksrp1984 opened this issue Nov 18, 2023 · 7 comments
Open

add external library and add_subdirectory to project tree #194

ksrp1984 opened this issue Nov 18, 2023 · 7 comments

Comments

@ksrp1984
Copy link

When I add "include_directories" they are added in the eclipse project. But if I use "add_library" or "add_subdirectory" which are not in the root directory of the project, then they are not displayed in the eclipse project. Maybe I'm doing something wrong in my CMakeList? Or is it impossible to add display of external files in the cmake4eclipse project? Is it possible to implement this somehow?

@15knots
Copy link
Owner

15knots commented Nov 19, 2023 via email

@inxksp
Copy link

inxksp commented Nov 27, 2023

I added symbolic links. Now the parser correctly analyzes functions and variables. But it doesn't recognize target_compile_definitions for subdirectories. Even if I add a definition with the "public" option to a subdirectory, this definition is correctly recognized by the parser in the main target's sources, but the parser does not see it in the subdirectory. The definition was added correctly to compile_commands.json. The compiler works correctly, i.e. all makefiles are created correctly. The problem is only with the parser

Perhaps the problem is that compile_commands.json contains the real path to the file and definitions of variables for this file. And the parser sees a link that is located in the project directory. Perhaps he thinks that these are different files? But then why does it correctly recognize the functions.

@15knots
Copy link
Owner

15knots commented Nov 27, 2023

I added symbolic links. Now the parser correctly analyzes functions and variables. But it doesn't recognize

symbolic links are not 'linked folders'. The latter can be added in the project properties on the Source Folders page.
You have to enable linked folders for your workbench first.

@ksrp1984
Copy link
Author

I tried it, nothing changed. The parser does not see compilation definitions in linked folders

@ksrp1984
Copy link
Author

ksrp1984 commented Nov 28, 2023

symbolic links are not 'linked folders'. The latter can be added in the project properties on the Source Folders page.
You have to enable linked folders for your workbench first.

Is it possible to look at the "cmake compilation DB" log. What data is transferred from it to the indexer. Only include directories are displayed in the project settings (Preprocessor Include Paths Macros etc). This may help me understand what the problem is, it's probably an internal parser error.

System: Windows, compiler: arm-none-eabi-gcc

@inxksp
Copy link

inxksp commented Nov 30, 2023

I looked at the parser log output. For the main file there is a section "Macro definitions (option -D)"
main.cpp:
Macro definitions (option -D):
DEBUG=1
SHARE_VAR=1
............
Macro definitions (from language + headers in index):
__builtin_offsetof(T,m)=(reinterpret_cast <size_t>(&reinterpret_cast <const volatile char &>(static_cast<T*> (0)->m)))
__builtin_types_compatible_p(x,y)=__builtin_types_compatible_p(sizeof(x),sizeof(y))
............

But for a file in a subdirectory only "Macro definitions (from language + headers in index)". There is no "Macro definitions (option -D)".

In compile_commands.json the -D macros are the same for all files

@ksrp1984
Copy link
Author

I was able to solve this problem by adding providers: Compilation Database Parser + CDT GCC Build Output Parser. For CDT The GCC build output parser needs to add "arm-none-eabi" to the "compiler command pattern". This works with the GCC compiler, but a solution could not be found for the IAR compiler (ARMCC).
Cmake compilation DB cannot determine compiler definitions (both arm-none-eabi and armcc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants