liorko liorko - 19 days ago 5
C++ Question

Building external libraries with cmake

I'm using cmake to build my library which needs external libraries. Each external library has it's own makefile. When I call this set of commands from my

CMakeLists.txt
file nothing is happening.

Any ideas what I'm doing wrong?

add_custom_target(blake
COMMAND mkdir -p ${LIBSCAPI_BUILDIR}/blake
&& cp -r ${LIBSCAPI_BUILDIR}/lib/BLAKE2/sse/. ${LIBSCAPI_BUILDIR}/BLAKE2
make -C ${LIBSCAPI_BUILDIR}/BLAKE2
make -C ${LIBSCAPI_BUILDIR}/BLAKE2 BUILDDIR=$(builddir) install
cp ${LIBSCAPI_BUILDIR}/BLAKE2/libblake2.a install/lib/
touch compile-blake)

Answer

For build a target by default, you need to add ALL option to the add_custom_target call:

add_custom_target(blake ALL
    COMMAND ...
)
Comments