cmake_minimum_required( VERSION 3.0 ) project( main ) find_package( PkgConfig REQUIRED ) pkg_check_modules( MYPKGS REQUIRED armadillo ) include_directories( ${MYPKGS_INCLUDE_DIRS} ) add_library( toto STATIC toto.cpp ) target_link_libraries( toto ${MYPKGS_LIBRARIES} ) add_executable( main main.cpp ) target_link_libraries( main toto ) install( TARGETS main DESTINATION bin )