Skip to content

Commit 6a1d632

Browse files
cmake: Support for extra defines supplied in command line call to cmake when building services
1 parent 257d746 commit 6a1d632

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

cmake/post.service.cmake

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ set_target_properties(service PROPERTIES OUTPUT_NAME ${BINARY})
6565
# DRIVERS / PLUGINS - support for parent cmake list specification
6666
#
6767

68+
# Add extra drivers defined from command line
69+
set(DRIVERS ${DRIVERS} ${EXTRA_DRIVERS})
70+
if(DRIVERS)
71+
list(REMOVE_DUPLICATES DRIVERS) # Remove duplicate drivers
72+
endif()
73+
# Add extra plugins defined from command line
74+
set(PLUGINS ${PLUGINS} ${EXTRA_PLUGINS})
75+
if(PLUGINS)
76+
list(REMOVE_DUPLICATES PLUGINS) # Remove duplicate plugins
77+
endif()
78+
6879
# Function:
6980
# Add plugin / driver as library, set link options
7081
function(configure_plugin type plugin_name path)
@@ -134,6 +145,12 @@ foreach(DEP ${DEPENDENCIES})
134145
add_dependencies(service ${DEP_NAME})
135146
endforeach()
136147

148+
# Add extra libraries defined from command line
149+
set(LIBRARIES ${LIBRARIES} ${EXTRA_LIBRARIES})
150+
if(LIBRARIES)
151+
list(REMOVE_DUPLICATES LIBRARIES) # Remove duplicate libraries
152+
endif()
153+
137154
# add all extra libs
138155
foreach(LIBR ${LIBRARIES})
139156
# if relative path but not local, use includeos lib.
@@ -267,8 +284,9 @@ function(add_memdisk DISK)
267284
endfunction()
268285

269286
# automatically build memdisk from folder
270-
function(diskbuilder FOLD)
287+
function(build_memdisk FOLD)
271288
get_filename_component(REL_PATH "${FOLD}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
289+
message(STATUS ${REL_PATH})
272290
add_custom_command(
273291
OUTPUT memdisk.fat
274292
COMMAND ${INSTALL_LOC}/bin/diskbuilder -o memdisk.fat ${REL_PATH}
@@ -279,6 +297,18 @@ function(diskbuilder FOLD)
279297
add_memdisk("${CMAKE_BINARY_DIR}/memdisk.fat")
280298
endfunction()
281299

300+
# build memdisk if defined
301+
if(MEMDISK)
302+
build_memdisk(${MEMDISK})
303+
endif()
304+
305+
# call build_memdisk only if MEMDISK is not defined from command line
306+
function(diskbuilder FOLD)
307+
if(NOT MEMDISK)
308+
build_memdisk(${FOLD})
309+
endif()
310+
endfunction()
311+
282312
if(TARFILE)
283313
get_filename_component(TAR_RELPATH "${TARFILE}"
284314
REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")

0 commit comments

Comments
 (0)