Skip to content

Commit 9ef85e0

Browse files
author
Gin
committed
Remove main from library target
1 parent c3f69f9 commit 9ef85e0

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

SerialPrograms/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,15 @@ else()
119119
find_package(Qt${QT_MAJOR} COMPONENTS Widgets SerialPort Multimedia MultimediaWidgets REQUIRED)
120120
endif()
121121

122-
#disable deprecated Qt APIs
122+
# disable deprecated Qt APIs
123123
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00)
124124

125-
#add current directory to find tesseractPA.lib
125+
# add current directory to find tesseractPA.lib
126126
link_directories(${CMAKE_CURRENT_LIST_DIR})
127127

128-
# add the list of all code file paths as ${MAIN_SOURCES}
128+
# add the list of all code file paths as ${LIBRARY_SOURCES} and ${EXECUTABLE_SOURCES}
129129
include(SourceFiles.cmake)
130130

131-
# Separate sources into library and executable components
132-
set(LIBRARY_SOURCES ${MAIN_SOURCES})
133-
list(REMOVE_ITEM LIBRARY_SOURCES "Source/CommonFramework/Main.cpp")
134-
# the executable needs the dark style format file
135-
set(EXECUTABLE_SOURCES "Source/CommonFramework/Main.cpp" "../3rdParty/qdarkstyle/dark/darkstyle.qrc")
136-
137131
# Organize source files in IDE project view
138132
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/../../ FILES ${LIBRARY_SOURCES})
139133
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/../../ FILES ${EXECUTABLE_SOURCES})

SerialPrograms/Scripts/add_new_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def get_code_file_range(file_lines: List[str], starting_line: str, ending_line:
8080
file_lines = read_lines(cmake_file_path)
8181
old_file_lines = file_lines
8282

83-
code_file_start, code_file_end = get_code_file_range(file_lines, "file(GLOB MAIN_SOURCES", ")")
83+
code_file_start, code_file_end = get_code_file_range(file_lines, "file(GLOB LIBRARY_SOURCES", ")")
8484
code_file_lines = set(file_lines[code_file_start:code_file_end])
8585
old_num_code_files = len(code_file_lines)
8686
print(f"{old_num_code_files} lines from SourceFiles.cmake are for code file paths")

SerialPrograms/SourceFiles.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
# This CMake file defines all the code file paths as the CMake variable ${MAIN_SOURCES}
1+
# This CMake file defines all the code file paths as the CMake variables
22
# For the main CMake file, see CMakeLists.txt
33

4-
file(GLOB MAIN_SOURCES
4+
# the executable needs the dark style format file
5+
set(EXECUTABLE_SOURCES "Source/CommonFramework/Main.cpp" "../3rdParty/qdarkstyle/dark/darkstyle.qrc")
6+
7+
file(GLOB LIBRARY_SOURCES
58
../3rdParty/ONNX/OnnxToolsPA.h
69
../3rdParty/QtWavFile/WavFile.cpp
710
../3rdParty/QtWavFile/WavFile.h
@@ -357,7 +360,6 @@ file(GLOB MAIN_SOURCES
357360
Source/CommonFramework/Logging/OutputRedirector.h
358361
Source/CommonFramework/Logging/QueuedLogger.cpp
359362
Source/CommonFramework/Logging/QueuedLogger.h
360-
Source/CommonFramework/Main.cpp
361363
Source/CommonFramework/Notifications/EventNotificationOption.cpp
362364
Source/CommonFramework/Notifications/EventNotificationOption.h
363365
Source/CommonFramework/Notifications/EventNotificationsTable.cpp

0 commit comments

Comments
 (0)