Skip to content

Commit

Permalink
cmake: Support for extra defines supplied in command line call to cma…
Browse files Browse the repository at this point in the history
…ke when building services
  • Loading branch information
AndreasAakesson committed Jul 6, 2017
1 parent 257d746 commit 7780ecf
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion cmake/post.service.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ set_target_properties(service PROPERTIES OUTPUT_NAME ${BINARY})
# DRIVERS / PLUGINS - support for parent cmake list specification
#

# Add extra drivers defined from command line
set(DRIVERS ${DRIVERS} ${EXTRA_DRIVERS})
list(REMOVE_DUPLICATES DRIVERS) # Remove duplicate drivers
# Add extra plugins defined from command line
set(PLUGINS ${PLUGINS} ${EXTRA_PLUGINS})
list(REMOVE_DUPLICATES PLUGINS) # Remove duplicate plugins

# Function:
# Add plugin / driver as library, set link options
function(configure_plugin type plugin_name path)
Expand Down Expand Up @@ -134,6 +141,10 @@ foreach(DEP ${DEPENDENCIES})
add_dependencies(service ${DEP_NAME})
endforeach()

# Add extra libraries defined from command line
set(LIBRARIES ${LIBRARIES} ${EXTRA_LIBRARIES})
list(REMOVE_DUPLICATES LIBRARIES) # Remove duplicate libraries

# add all extra libs
foreach(LIBR ${LIBRARIES})
# if relative path but not local, use includeos lib.
Expand Down Expand Up @@ -267,8 +278,9 @@ function(add_memdisk DISK)
endfunction()

# automatically build memdisk from folder
function(diskbuilder FOLD)
function(build_memdisk FOLD)
get_filename_component(REL_PATH "${FOLD}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
message(STATUS ${REL_PATH})
add_custom_command(
OUTPUT memdisk.fat
COMMAND ${INSTALL_LOC}/bin/diskbuilder -o memdisk.fat ${REL_PATH}
Expand All @@ -279,6 +291,18 @@ function(diskbuilder FOLD)
add_memdisk("${CMAKE_BINARY_DIR}/memdisk.fat")
endfunction()

# build memdisk if defined
if(MEMDISK)
build_memdisk(${MEMDISK})
endif()

# call build_memdisk only if MEMDISK is not defined from command line
function(diskbuilder FOLD)
if(NOT MEMDISK)
build_memdisk(${FOLD})
endif()
endfunction()

if(TARFILE)
get_filename_component(TAR_RELPATH "${TARFILE}"
REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
Expand Down

0 comments on commit 7780ecf

Please sign in to comment.