Skip to content

Commit 1e53230

Browse files
committed
Simplify header adding function
1 parent f051b0e commit 1e53230

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

CMakeLists.txt

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,14 @@ add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
100100

101101
include(cmake/Macros.cmake)
102102

103-
# Initialize a global empty list to hold all the source files
104-
set_property(GLOBAL PROPERTY INTERNAL_CCMATH_SOURCES "")
105-
106103
# Helper function to add headers to the global source list
107104
function(ccm_add_headers)
108-
# Retrieve the current global property value
109-
get_property(tmp GLOBAL PROPERTY INTERNAL_CCMATH_SOURCES)
110-
111-
foreach (arg ${ARGV})
112-
list(APPEND tmp "${arg}")
113-
endforeach ()
114-
115-
# Update the global property using APPEND
116-
set_property(GLOBAL PROPERTY INTERNAL_CCMATH_SOURCES "${tmp}")
105+
# Append all the passed arguments (headers) to the target's sources
106+
target_sources(${PROJECT_NAME} INTERFACE "$<BUILD_INTERFACE:${ARGV}>")
117107
endfunction()
118108

119109
add_subdirectory(include/ccmath)
120110

121-
# Add all the headers to the target interface
122-
get_property(internal_ccmath_headers GLOBAL PROPERTY INTERNAL_CCMATH_SOURCES)
123-
target_sources(${PROJECT_NAME} INTERFACE "$<BUILD_INTERFACE:${internal_ccmath_headers}>")
124-
125-
126111
target_include_directories(${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>)
127112
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)
128113

0 commit comments

Comments
 (0)