Comments (3)
so i guess whats happening is that include_directories
puts thirdparty/simpleini
in the include list, and the ../../discord/foo
turns into thirdparty/simpleini/../../discord/foo
which resolves to discord/foo
which happens to work out? would correcting the 2 broken #include
s not be sufficient to fix the issue here? i guess i just dont see how this issue is particular to dependencies/submodules other than thats just what happened to cause it to compile correctly despite the broken paths.
as for making all the includes relative to the base directory thats a good idea and might be something worth doing from now on. i guess that would just look like a (target_)include_directories(${CMAKE_CURRENT_SOURCE_DIR})
? (as u can tell im not much of a CMake expert)
also i guess re. your last point i should try and have the CMakeLists.txt look for simpleini and include as a submodule if its not found in the same kinda way i do ixwebsocket? or a find module
from abaddon.
so i guess whats happening is that include_directories puts thirdparty/simpleini in the include list, and the ../../discord/foo turns into thirdparty/simpleini/../../discord/foo which resolves to discord/foo which happens to work out?
That's exactly what's happening here. I wouldn't have noticed it if there was just some other directory two directories below the repo root in the include path.
would correcting the 2 broken #includes not be sufficient to fix the issue here?
would definitely be, but it isn't a very elegant solution (I hope I made that clear in my initial issue description).
i guess i just dont see how this issue is particular to dependencies/submodules other than thats just what happened to cause it to compile correctly despite the broken paths.
It is definitely not directly related to submodules, but it make a compilation fail when building from a source tarball (apart from vendored dependencies, of course).
as for making all the includes relative to the base directory thats a good idea and might be something worth doing from now on. i guess that would just look like a (target_)include_directories(${CMAKE_CURRENT_SOURCE_DIR})? (as u can tell im not much of a CMake expert)
Yes, the approach I recommend is just including the source directory (in this case, ${CMAKE_CURRENT_SOURCE_DIR}
). In other projects (e.g. where all sources are below src
) I would include that src
directory.
As a rule of thumb, just try to make the #include
statements look uniform and easily readable.
This usually just means including the source directory and (if present) a header directory (which doesn't exist in this case).
And I recommend not using include_directories()
but rather target_include_directories()
so the settings only apply to certain targets. But in simple CMake projects there isn't much of a difference, so it's more or less not important which one you use.
also i guess re. your last point i should try and have the CMakeLists.txt look for simpleini and include as a submodule if its not found in the same kinda way i do ixwebsocket? or a find module
Well, since simpleini is not very distro maintainer friendly (it really wants to be included as a submodule), it is best to write a find module to look for the header file in common directories (standard include directory, e.g. /usr/include
).
To make builds more independent of the particular build machine, it might also be better to enforce either vendored or system-wide dependencies with configure-time options. But that's not such a big issue in this case. I've just had experience with projects like polybar which check for software installed on the system at compile time and configure their project's features accordingly. This is, of course, easy to use, but is very intransparent if e.g. polybar gets installed before one of those hidden dependencies and the user is facing the problem that polybar misses support for this certain feature, because polybar didn't see the hidden dependency installed at compile time. Still, this issue doesn't apply here, so it's not that important.
To sum it up, here's my recommendation:
- Make all
#include
statements for header files which reside in the repository relative to the repository root without./
or../
- Add
target_include_directories(... ${CMAKE_CURRENT_SOURCE_DIR})
in CMakeLists.txt - Write a find module for simpleini
- Search for simpleini using the find module
- (optionall) Add options to enforce either using vendored or system-wide dependencies
from abaddon.
i'll close this since the root issue should be gone. i'm still not super clear on what youre referring to with the last bullet point but if its still a concern then i'd make a new issue for it specifically (my guess is you mean an option that forces all or nothing for the dependencies). im not too concerned with the #include
paths for now but ill probably start converting them as i end up touching the files. ill probably have a find module for simpleini in soon.
from abaddon.
Related Issues (20)
- VC Leave/Join sounds
- Game activity detection support
- BUG: Token not fetched from INI file HOT 3
- libfmt version conflict causing the build to fail HOT 4
- ability to change your own and see other users pronouns HOT 1
- Silent message support HOT 2
- Token issue HOT 6
- Clang build crashes HOT 3
- Add rounded avatars HOT 1
- [Suggestion] Option to show only the channels of currently selected guild HOT 4
- Links colored black after PR #252 HOT 3
- No Audio at VC Move HOT 2
- Error while building (WINDOWS) HOT 8
- [remote-auth-ws] [error] Websocket error: Status: 0 Reason: Unable to connect to remote-auth-gateway.discord.gg on port 443, error: OpenSSL failed - error:0A000086:SSL routines::certificate verify failed HOT 1
- Install target does not install the main binary HOT 9
- Default folder for resources and css on macOS is really odd and no configure option available to set the right path HOT 5
- macOS needs a several fixes for subprojects: how to do that, technically?
- URI handler opens links and pictures in MS Word HOT 2
- Consider changing (removing) QR code colours. HOT 3
- Latest version ignores "mobile = true" ini flag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abaddon.