Fix CMakeLists for compatibility 75/94275/1 accepted/tizen/3.0/ivi/20161102.075743 accepted/tizen/3.0/mobile/20161102.075610 accepted/tizen/3.0/tv/20161102.075641 accepted/tizen/3.0/wearable/20161102.075716 accepted/tizen/common/20161031.122117 accepted/tizen/ivi/20161101.005350 accepted/tizen/mobile/20161101.005255 accepted/tizen/tv/20161101.005310 accepted/tizen/wearable/20161101.005331 submit/tizen/20161031.090409 submit/tizen_3.0/20161102.051512
authorJiwoong Im <jiwoong.im@samsung.com>
Fri, 28 Oct 2016 02:40:53 +0000 (11:40 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Fri, 28 Oct 2016 02:40:53 +0000 (11:40 +0900)
- Fix CMakeLists to include additional source files automatically

Change-Id: Id2831fd66456e4a22cfa1fa92c32554e323ccf2e
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
CMakeLists.txt
src/CMakeLists.txt

index 7d88d2e..2b50ad4 100644 (file)
@@ -25,12 +25,7 @@ FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall -Werror")
 ENDFOREACH(flag)
 
-SET (${this_target}_SOURCE_FILES
-       alarm-manager-registry.c
-       alarm-manager-schedule.c
-       alarm-manager-timer.c
-       alarm-manager.c
-       )
+AUX_SOURCE_DIRECTORY(./ SRCS)
 
 ADD_CUSTOM_COMMAND(
         WORKING_DIRECTORY
@@ -40,7 +35,7 @@ ADD_CUSTOM_COMMAND(
                                ./alarm_mgr.xml
         COMMENT "Generating Server GDBus .c/.h")
 
-ADD_EXECUTABLE (${this_target} ${${this_target}_SOURCE_FILES} alarm-mgr-stub.c)
+ADD_EXECUTABLE (${this_target} ${SRCS} alarm-mgr-stub.c)
 ADD_DEPENDENCIES(${this_target} alarm)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fpie")
index 06f905d..a40387b 100644 (file)
@@ -11,10 +11,7 @@ FOREACH(flag ${lib_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(${this_target}_SOURCE_FILES
-       alarm-lib.c
-       alarm-lib-stub.c
-)
+AUX_SOURCE_DIRECTORY(./ LIB_SRCS)
 
 ADD_CUSTOM_COMMAND(
         WORKING_DIRECTORY
@@ -26,7 +23,7 @@ ADD_CUSTOM_COMMAND(
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Wno-unused -fvisibility=hidden")
 
-ADD_LIBRARY(${this_target} SHARED ${${this_target}_SOURCE_FILES} alarm-mgr-stub.c)
+ADD_LIBRARY(${this_target} SHARED ${LIB_SRCS} alarm-mgr-stub.c)
 
 SET_TARGET_PROPERTIES(${this_target} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
 SET_TARGET_PROPERTIES(${this_target} PROPERTIES LINK_FLAGS "-Wl,--as-needed -Wl,--hash-style=both")
@@ -44,6 +41,10 @@ TARGET_LINK_LIBRARIES(${this_target} ${lib_pkgs_LDFLAGS})
 # pkgconfig file
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/alarm-service.pc.in ${CMAKE_SOURCE_DIR}/alarm-service.pc @ONLY)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/alarm-service.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/ FILES_MATCHING PATTERN "alarm.h")
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/
+       FILES_MATCHING
+       PATTERN "*-internal.h" EXCLUDE
+       PATTERN "*.h"
+       )
 INSTALL(TARGETS ${this_target} DESTINATION ${CMAKE_INSTALL_LIBDIR})