0

I may lack in general understanding of how I should build a project like libical. I am trying to build this and add it to my main project.

After reading its install instructions, I ran these commands in the cloned libical folder:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/my/project -DICAL_BUILD_DOCS=false
make

Which then created codes in the build folder. I copied over this build folder to my project, added all source and header under "src" folder to CMakeLists.txt like this:

set(LIBICAL_SRCS
    src/libical/icalderivedparameter.c
    src/libical/icalderivedproperty.c
    src/libical/icalderivedvalue.c
    src/libical/icalrestriction.c
    )

set(LIBICALGLIB_SRCS
    src/libical-glib/i-cal-array.c
    src/libical-glib/i-cal-attach.c
    src/libical-glib/i-cal-comp-iter.c
    src/libical-glib/i-cal-component.c
    src/libical-glib/i-cal-datetimeperiod.c
    src/libical-glib/i-cal-derived-parameter.c
    src/libical-glib/i-cal-derived-property.c
    src/libical-glib/i-cal-derived-value.c
    src/libical-glib/i-cal-duration.c
    src/libical-glib/i-cal-enums.c
    src/libical-glib/i-cal-error.c
    src/libical-glib/i-cal-geo.c
    src/libical-glib/i-cal-memory.c
    src/libical-glib/i-cal-mime.c
    src/libical-glib/i-cal-object.c
    src/libical-glib/i-cal-parameter.c
    src/libical-glib/i-cal-parser.c
    src/libical-glib/i-cal-period.c
    src/libical-glib/i-cal-property.c
    src/libical-glib/i-cal-recur-iterator.c
    src/libical-glib/i-cal-recur.c
    src/libical-glib/i-cal-recurrence.c
    src/libical-glib/i-cal-reqstat.c
    src/libical-glib/i-cal-restriction.c
    src/libical-glib/i-cal-time-span.c
    src/libical-glib/i-cal-time.c
    src/libical-glib/i-cal-timezone.c
    src/libical-glib/i-cal-trigger.c
    src/libical-glib/i-cal-unknowntokenhandling.c
    src/libical-glib/i-cal-value.c
  )

set(includedirs
    src
  )

set(srcs ${LIBICAL_SRCS} ${LIBICALGLIB_SRCS})
idf_component_register(INCLUDE_DIRS ${includedirs} SRCS ${srcs} ) # it is SDK specific 

Now, I am running into compilation errors such as:

In file included from /Users/workspace/embedded/blink/components/libical/src/libical/icalderivedproperty.c:23:
/Users/workspace/embedded/blink/components/libical/src/libical/icalderivedproperty.h:23:10: fatal error: icalparameter.h: No such file or directory
 #include "icalparameter.h"
          ^~~~~~~~~~~~~~~~~

I could not find icalparameter.h within the generated folder. However, there is a file with very similar name i-cal-parameter.h under src/libical-glib.

Now I wonder if this is a correct way of generating the libical and importing into my project. What is glib? Should I be including only this folder? Can someone guide me how to properly build projects like this to import it as a library to other projects?

Megool
  • 963
  • 2
  • 8
  • 29
  • Hello, libical contains a CMakeLists.txt as its root dir and so, you can clone this project (git submodule is great for this). Then, from your main project CMakeLists, you can call `add_subdirectory(path_to_libical)`. If everything goes well, you should be able to build a CMake target you can link your project to. You may need to add some variables to build what you want, (static, shared, enable unit test or not, etc..) – Martin Apr 24 '23 at 08:17
  • @Martin The provided CMakeLists in libical conflict when used with my ESP-IDF project, resulting in errors like `enable_language command is not scriptable`. libical's CMakeLists seems pretty long and complicated. Would you say I should be modifying this to work with the ESP-IDF? – Megool Apr 24 '23 at 16:52

0 Answers0