Choose your top Archicad wishes!

Read more
Archicad C++ API
About Archicad add-on development using the C++ API.

Issues with Project Dependency Configuration using CMake

pagliu96
Contributor

Hello everyone,

 

I'm reaching out to you because I'm encountering some difficulties in configuring the dependencies of my project using CMake, and I would like to ask for your help in resolving them.

 

Problem Description: I'm currently working on a project that utilizes several external libraries, including Boost, Catch2, fakeit, gsl-lite, magic_enum, spdlog, archicad_adk, and range-v3. These libraries are necessary for the development of my project, but I'm facing challenges in properly configuring the dependencies using CMake.

 

I've followed the instructions to correctly import these libraries into my project using find_package; however, during compilation, I'm receiving errors indicating that dependency header files cannot be found.

 

For example, I'm getting the error "Cannot open include file: 'Archicad/ACAPinc.h': No such file or directory" while compiling my ArchicadApi.cpp file, which depends on the archicad_adk library.

 

pagliu96_0-1714493274713.png

I've checked the presence of header files, and it seems that everything is configured correctly in CMake, but I'm unable to understand why the compilation is failing.

pagliu96_1-1714493286608.png

 

 

What I've Tried So Far:

  • I've checked the configuration of Conan and ensured that dependencies are correctly installed in my environment.
  • I've verified that the paths to dependency header directories are properly included in my CMake project using target_include_directories.
  • I've carefully examined the compilation errors to try to pinpoint the root cause of the issue.

 

It's worth mentioning that the problem likely arises from the interaction between Conan 2.2.2 and CMake. Specifically, the issue seems to be related to the integration of libraries obtained from Conan configuration files into a generic library named Common. Despite the fact that the include directories should theoretically be automatically propagated to Common using the INTERFACE qualifier, it appears that this automatic propagation might not be occurring as expected.

 

My Approach: In an attempt to address this issue, I've manually tried to force the inclusion of these directories by directly using the targets provided by Conan. Although this workaround involves a more manual process, I hoped it would ensure that the necessary include directories are properly added to the Common library. However, despite these efforts, the problem persists (it can't find the include paths even if they are in the project --- check the first image).

  • If anyone has encountered similar issues or has insights into how to better integrate Conan-managed dependencies with CMake, I would greatly appreciate your input and suggestions.

 

Question: Could you kindly provide me with some suggestions on what I could do to resolve these dependency configuration issues with CMake? I'm open to any advice or guidance that could help me overcome this challenge.

 

Thank you in advance for your assistance!

 

The three files involved in the building process have been attached (CMakeLists.txt, cmake/Archicad.cmake and conanfile.py).

 

Best regards,

Manuel

2 REPLIES 2
Ralph Wessel
Mentor

Just a basic question - does CMake have the means for find_package to locate archicad_adk in your dev environment?

Ralph Wessel BArch

Yes it does, it has access to the configurations file generated from Conan.