Azure / azure-c-shared-utility

Azure C SDKs common code
Other
111 stars 203 forks source link

Headers installed under non-standard directory, causes build breaks #530

Closed thalesx closed 3 years ago

thalesx commented 3 years ago

Per the cmake like below, the SDK's C headers get installed under /usr/include/azureiot/azure_c_shared_utility.

https://github.com/Azure/azure-c-shared-utility/blob/341c40b8ce15d2372d9407ef537b0abe45c452d4/CMakeLists.txt#L692

However, many of the SDK's headers include other SDK headers using (1) #include "azure_c_shared_utility/other_header.h" instead of (2) #include "azureiot/azure_c_shared_utility/other_header.h".

The issue is that, for a project consuming the C SDK in the form of a lib installed in the sysroot, only the /usr/include is in the include search path by default; the directory /usr/include/azureiot is not. Therefore, the header includes of the form (1) fail.

By patching the c-utility CMakeList.txt to install the headers in ${CMAKE_INSTALL_INCLUDEDIR}/azure_c_shared_utility, I got it to work for my project. Alternatively the includes of form (1) could be changed to (2).

danewalton commented 3 years ago

Hi @thalesx thanks for the feedback. Would this solve it? https://github.com/Azure/azure-c-shared-utility/pull/531

danewalton commented 3 years ago

FWIW this is what I see on the install step after the change:

image

thalesx commented 3 years ago

Yes! That solves it.

momuno commented 3 years ago

Reverting fix due to vcpkg build break, reopening issue.