CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(app2ext C CXX) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall -Werror") SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") INCLUDE(FindPkgConfig) INCLUDE(ApplyPkgConfig) PKG_CHECK_MODULES(app2ext_libpkgs REQUIRED dlog glib-2.0) PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock) FOREACH(flag ${app2ext_libpkgs_CFLAGS}) SET(APP2EXT_CFLAGS "${APP2EXT_CFLAGS} ${flag}") ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${EXTRA_CFLAGS} ${APP2EXT_CFLAGS}") ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"") # Local include directories INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc) # build app2ext library SET(APP2EXT "app2ext") AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src APP2EXT_SRCS) ADD_LIBRARY(${APP2EXT} SHARED ${APP2EXT_SRCS}) SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES SOVERSION ${MAJORVER}) SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES VERSION ${FULLVER}) SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIC -fstack-protector-strong") SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES LINK_FLAGS "-Wl,--as-needed,-z,relro") TARGET_LINK_LIBRARIES(${APP2EXT} ${app2ext_libpkgs_LDFLAGS}) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.pc.in ${CMAKE_BINARY_DIR}/app2sd.pc @ONLY) INSTALL(TARGETS ${APP2EXT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/app2sd.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION include) ADD_SUBDIRECTORY(plugin/app2sd) ADD_SUBDIRECTORY(test) ADD_SUBDIRECTORY(unit-tests)