CMakelists.txt not containing target include directories #1982
Replies: 10 comments
-
Hi @lefebvresam , If you would like, you could use our vcpkg port. Please see the following guide. |
Beta Was this translation helpful? Give feedback.
-
These are the steps:
Remarks: |
Beta Was this translation helpful? Give feedback.
-
I just happen to have just tried to integrate the sdk as a module as @lefebvresam as agree that it is not possible to use it as a module due to missing target_include_directories, et al. (@lefebvresam let me know if you agree with the following wrap-up) Thank @ewertons for the link, I have just checked and it seems to me that I could summaries the difference between what it is possible and the proposed improvement:
One example for this is Cmake FetchContent for googletest, other libraries supports it, and some reasonings towards this approach could be found in this article or this repo. (it seems to me that was also proposed by #603 (comment)) The Cmake of this SDK seems already well organized, the effort forwards this future-proof addition is probably little. |
Beta Was this translation helpful? Give feedback.
-
I totally agree. The advantage by using the SDK as a GIT submodule is that you can refer to a specific revision in your GIT submodule dependency files and you can go trough the source code in your IDE. This is important when you have to copy macros or specific variables when you integrate the SDK into a C++ project, or you want to debug and add extra logging in the source. |
Beta Was this translation helpful? Give feedback.
-
Hi @lefebvresam and @neonsoftware I agree we can make some improvements in our CMake. These were originally written years ago before the days of "Modern CMake" and haven't been updated with the times. I'll see if I can budget a bit of time to try and go through to enable the scenario y'all are talking about. Thanks for the feedback. |
Beta Was this translation helpful? Give feedback.
-
Hi @danewalton, |
Beta Was this translation helpful? Give feedback.
-
Just one last thing, @ewertons and @danewalton, in view of the exchange of informations in this issues, would it be possible, or appropriate, to move the issue's label 'question' to 'enhancement' ? |
Beta Was this translation helpful? Give feedback.
-
Yup can do....relabeled |
Beta Was this translation helpful? Give feedback.
-
Hi @danewalton and @ewertons , First of all, thank you for taking a look at this topic. I have been using different azure libraries in the last month and have seen, scattered around the libraries, different CMake adjustments required. I would like to ask you
Thanks. |
Beta Was this translation helpful? Give feedback.
-
I can confirm I also had had that problem back in 2021 and found a small workaround to be: # Get the includes of Azure IOT SDK as it does not publish them within its library target
get_target_property(azureiot_includes iothub_client INCLUDE_DIRECTORIES)
target_include_directories(${TARGET} PUBLIC ${azureiot_includes}) But as of newer versions, at least with LTS_08_2023, this doesn't seem to be necessary anymore. |
Beta Was this translation helpful? Give feedback.
-
Development Machine, OS, Compiler (and Other Relevant Toolchain Info)
WSL2 on Windows10 education pro
Cross compiled for arm on Ubuntu 20.04
SDK Version (Please Give Commit SHA if Manually Compiling)
1.4.1
Describe the Bug
When linking the project in an existing cmake project, you have to add the include directories manually to enable finding the header files:
Normally the target_include_directories must be already in the top CMakelists.txt of the project.
Beta Was this translation helpful? Give feedback.
All reactions