Following the instructions to compile dlib using cmake (here) generates a static dlib library:
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config
According to dlib/CMakeLists.txt
, standalone (not from examples
) building of dlib
also creates shared library named dlib-shared
:
mkdir shared_build # Build directory can be any
cd shared_build
cmake ..
cmake --build . --config Release
make install # Install library for make it acessible for others
For use this library in examples, you need to add definition of dlib
library into your examples/CMakeLists.txt
before include(../dlib/cmake)
.
examples/CMakeLists.txt:
...
PROJECT(examples)
add_library(dlib SHARED IMPORTED) # Imported(!) dlib target
set_target_properties(dlib PROPERTIES IMPORTED_LOCATION "")
# Now it is safe to include other dlib infrustucture - it won't build dlib again.
include(../dlib/cmake)
...