cmake_minimum_required(VERSION 3.0) include(FindPkgConfig) set(core_src_files backend_config_reader.cpp core.cpp core_config.cpp job.cpp job.h job_receiver.cpp result.cpp states.cpp xml_result.cpp xml_states.cpp ) find_package(EXPAT REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules (GLIB2 glib-2.0 REQUIRED) pkg_check_modules (XERCES xerces-c REQUIRED) include_directories(.. ${XERCES_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS}) link_directories(${XERCES_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS}) # https://cmake.org/Wiki/CMake/Tutorials/Object_Library add_library(core ${core_src_files}) target_link_libraries(core ${XERCES_LIBRARIES} expat)