0

I have autotools project and I would like to add some third-party source code (libsoxr) with own cmake configuration. But I don't know what add to configure.ac and makefile.am.

I need execute this commands:

libsoxr/cmake -DBUILD_SHARED_LIBS=OFF
libsoxr/make

and than link libsoxr/src/libsoxr.a to my own code

Does somebody know anything about this configuration?

nouney
  • 4,363
  • 19
  • 31
Meph-
  • 657
  • 1
  • 8
  • 20

1 Answers1

0

I happened to be in the same situation, and solved the issue using the AC_CONFIG_FILES macro in configure.ac. A simplified version of the code is:

AC_CONFIG_FILES(mylib-build/Makefile:mylib/CMakeLists.txt,
  mkdir -p mylib-build ; cd mylib-build ;
  cmake \
  -DCMAKE_INSTALL_PREFIX=$prefix \
  -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
  ${srcdir}/mylib ; 
  if [test $? != 0 ] ; 
  then 
    AC_MSG_ERROR([mylib: Cmake configuration failed. Check the error message above.])
  fi 
  cd ..
  , prefix=$prefix CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
)

In Makefile.am I just added mylib-build as a sub-directory:

SUBDIRS = mylib-build

Note that I am by no means an auto-tools expert, so that this solution may not be the cleanest possible.

Massimiliano
  • 7,842
  • 2
  • 47
  • 62