cmake: avoid redundant source list in Android lib vs executable check
authoruser <user@example.com>
Tue, 14 Jan 2020 17:42:02 +0000 (18:42 +0100)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 18 Jan 2020 13:05:59 +0000 (14:05 +0100)
Factor out a common list of input files (sources, and resources) in
the conditional instructions which either build a shared object or an
executable from the same list of input files.

CMakeLists.txt

index 38252fddecfb024745f801aaf4673dc0df66f3ce..5330663dbf755100dfb99c42296e14a9681d8a43 100644 (file)
@@ -528,10 +528,11 @@ if(ANDROID)
        list(APPEND PULSEVIEW_LINK_LIBS "-llog")
 endif()
 
+set(INPUT_FILES_LIST ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC} ${QM_FILES})
 if(ANDROID)
-       add_library(${PROJECT_NAME} SHARED ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC} ${QM_FILES})
+       add_library(${PROJECT_NAME} SHARED ${INPUT_FILES_LIST})
 else()
-       add_executable(${PROJECT_NAME} ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC} ${QM_FILES})
+       add_executable(${PROJECT_NAME} ${INPUT_FILES_LIST})
 endif()
 
 target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS})