Arrange CmakeLists.txt 83/160183/3
authorSeungha Son <seungha.son@samsung.com>
Wed, 15 Nov 2017 00:17:33 +0000 (09:17 +0900)
committerSeungha Son <seungha.son@samsung.com>
Fri, 17 Nov 2017 06:43:22 +0000 (15:43 +0900)
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: Iff4ed8cd3c9e399ad1153423e7a55b8ae1b9b185

CMakeLists.txt

index b631c96..4bea017 100755 (executable)
@@ -1,44 +1,15 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(badge C)
 
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_PREFIX "\${prefix}")
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
-
 SET(CMAKE_SKIP_BUILD_RPATH true)
 
-SET(INSTALL_HEADERS_DEVEL
-       badge.h
-       badge_error.h
-       badge_internal.h
-       badge_db.h
-       badge_setting.h
-       badge_setting_service.h
-       badge_ipc.h
-)
-
 SET(INIT-SRCS
        src/badge_init.c
 )
 
-SET(SRCS
-       src/badge.c
-       src/badge_error.c
-       src/badge_db.c
-       src/badge_ipc.c
-       src/badge_internal.c
-       src/badge_setting.c
-       src/badge_setting_service.c
-)
-
-SET(SUBMODULES_DEVEL
-       badge
-       badge-service
-)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+AUX_SOURCE_DIRECTORY(src SRCS)
+LIST(REMOVE_ITEM SRCS ${INIT-SRCS})
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs REQUIRED
@@ -60,7 +31,6 @@ FOREACH(flag ${pkgs_CFLAGS})
 ENDFOREACH(flag)
 
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -g -Wall -Werror -Wno-error=deprecated-declarations -O2")
-
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
 
 ADD_DEFINITIONS("-DBADGE_USE_DLOG")
@@ -74,16 +44,17 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
 ADD_EXECUTABLE(badge_init ${INIT-SRCS})
 TARGET_LINK_LIBRARIES(badge_init ${pkgs_LDFLAGS} badge "-pie")
 
-MESSAGE(${LIB_INSTALL_DIR} ====)
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
 
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-FOREACH(hfile ${INSTALL_HEADERS_DEVEL})
-       INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/${hfile} DESTINATION include/${PROJECT_NAME})
-ENDFOREACH(hfile)
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/
+               DESTINATION include/${PROJECT_NAME}
+               FILES_MATCHING
+               PATTERN "*_log.h" EXCLUDE
+               PATTERN "*_private.h" EXCLUDE
+               PATTERN "*.h")
 
 INSTALL(FILES ${CMAKE_BINARY_DIR}/11_badge-add.post DESTINATION ${SYSCONF_INSTALL_DIR}/gumd/useradd.d/)
 INSTALL(TARGETS badge_init DESTINATION bin)