CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(alarm-engine C) SET(VERSION_MAJOR 0) SET(VERSION "${VERSION_MAJOR}.0.0") #IF($ENV{ARCH} MATCHES "arm") # MESSAGE("Architecture: $ENV{ARCH}") # SET(ENV{PKG_CONFIG_PATH} "/usr/x1/lib/pkgconfig:/opt/x1/lib/pkgconfig") # SET(CMAKE_C_COMPILER "arm-linux-gcc") # SET(CMAKE_CXX_COMPILER "arm-linux-g++") # SET(CMAKE_SKIP_BUILD_RPATH TRUE) # SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) # SET(CMAKE_INSTALL_RPATH "/usr/x1/lib:/opt/x1/lib") # SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) #ENDIF($ENV{ARCH} MATCHES "arm") SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX ${PREFIX}) SET(INCLUDEDIR "/usr/include") SET(PKGCONFIGDIR "/usr/lib/pkgconfig") SET(DBDIR "/opt/dbspace") SET(LIBDIR "/usr/lib") SET(UGLIBDIR "/opt/ug/lib") SET(VERSION 0.1) SET(KIES_ALM_DIR "kies_alarm") SET(LIB_NAME_KIES_ALM "kies_alarm") #c file SET(SRCS src/libalarm.c src/db.c ) #include file INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) #dependency INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED gobject-2.0 glib-2.0 dlog db-util ) #CFlags FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -ldl") #SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -finstrument-functions") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") #definitions ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") #add lib ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -lpthread -ldl) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) #pc file CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) #install lib INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR} COMPONENT RuntimeLibraries) #install pc file INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${PKGCONFIGDIR}) #install head file INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}.h DESTINATION ${INCLUDEDIR}) #INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/.alarm.db DESTINATION ${DBDIR}) #INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/.alarm.db-journal DESTINATION ${DBDIR}) #kies_alarm ADD_SUBDIRECTORY(${KIES_ALM_DIR}) #test case ADD_SUBDIRECTORY(test)