Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge to CMake to handle pre-built automake libraries from 'common' #12

Open
Miha22 opened this issue Nov 16, 2024 · 0 comments
Open

Comments

@Miha22
Copy link

Miha22 commented Nov 16, 2024

There has to be note to create/generate: AUTHORS Changelog NEWS, config (for autoheader) and "m4" dir, and issue in utils.c to include <sys/time> but not time

Suggesting improvements in makefiles (.am), instead of forcing to have folder 'common' would be better to have relative include $(srcdir) in AM_CPPFLAGS.

1) AM_CPPFLAGS = -I$(srcdir)/rb_tree 
AM_CPPFLAGS = -I$(srcdir)/rb_tree 

instead of 

AM_CPPFLAGS = -I$(top_srcdir)/common/libinterval3/rb_tree

2) 

libinterval3_la_SOURCES = \
	interval_tree.c

libinterval3_la_LIBADD = rb_tree/librbtree.la \
			$(CONDITIONAL_LIBS)

instead of

libinterval3_la_LIBADD = $(top_builddir)/common/libinterval3/rb_tree/librbtree.la \
			$(CONDITIONAL_LIBS)

3) Remove header from 
libinterval3_la_SOURCES = \
	interval_tree.c interval_tree.h


because headers dont belong in *_SOURCES. They should only be included in AM_CPPFLAGS of needed.

4) Add short CmakeLists.txt

add_library(cccommon
    libpatricia/patricia.c
    //rest if needed kuje libinterval3/interval_tree.h (for interval tree the red black tree as well)
)

# Add include directories
target_include_directories(cccommon PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/libpatricia
    .... // the rest if needed like ${CMAKE_CURRENT_SOURCE_DIR}/libcsv
    etc.
)

-------------------------
In improved case user can submodule the cc-common to any directory such as **lib/cccommon**. 

In the source proeject CMakeLists.txt to add subdirectory to invoke short CMakeLists.txt and link it.

add_subdirectory(lib/cccommon)
target_include_directories(my_project_name PRIVATE
    ${CMAKE_SOURCE_DIR}/lib/cccommon
    ${CMAKE_SOURCE_DIR}/lib/cccommon/libpatricia
    // and the rest like ${CMAKE_SOURCE_DIR}/lib/cccommon/libcsv
    //etc.
)

------------------------
packges: autoconf automake libtool
----------------------------
autoreconf -i
 ./configure
make
-------------
cmake -S . -B
cmake --build build
@Miha22 Miha22 changed the title Improvement Bridge to CMake to handle pre-built automake libraries from 'common' Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant