From e2ae5607e9560caa7fd41e212674762bafcb752f Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Fri, 12 Jan 2018 22:00:11 +0100 Subject: [PATCH] add handling of sub-dependencies, fix profile selection --- tools/export/cmake/CMakeLists.txt.tmpl | 5 +++-- tools/export/cmake/__init__.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/export/cmake/CMakeLists.txt.tmpl b/tools/export/cmake/CMakeLists.txt.tmpl index 236ace8d61..c67cf09059 100644 --- a/tools/export/cmake/CMakeLists.txt.tmpl +++ b/tools/export/cmake/CMakeLists.txt.tmpl @@ -51,6 +51,7 @@ ADD_LIBRARY({{libname}} STATIC ADD_EXECUTABLE({{name}} {% for src in sources %}{{src}} {% endfor %}) +SET_TARGET_PROPERTIES({{name}} PROPERTIES ENABLE_EXPORTS 1) TARGET_LINK_LIBRARIES({{name}} {% for libname in dependencies.keys()|sort(reverse=true) %}{{libname}} {% endfor %}) @@ -89,8 +90,8 @@ ELSE() ENDIF() # optional custom target to build via mbed-cli -ADD_CUSTOM_TARGET(mbed-cli-build EXCLUDE_FROM_ALL - COMMAND ${CMAKE_COMMAND} -E echo "mbed compile --build BUILD/${CMAKE_BUILD_TYPE} ${MBED_BUILD_PROFILE}" +ADD_CUSTOM_TARGET(mbed-cli-build + COMMAND ${CMAKE_COMMAND} -E echo "mbed compile --build BUILD/${CMAKE_BUILD_TYPE} --profile ${MBED_BUILD_PROFILE}" COMMAND mbed compile --build BUILD/${CMAKE_BUILD_TYPE} --profile ${MBED_BUILD_PROFILE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} SOURCES ${SOURCE_FILES} ${SYS_SOURCE_FILES}) diff --git a/tools/export/cmake/__init__.py b/tools/export/cmake/__init__.py index f1bc47b076..79e815d29d 100644 --- a/tools/export/cmake/__init__.py +++ b/tools/export/cmake/__init__.py @@ -67,7 +67,7 @@ class CMake(Exporter): # create a list of dependencies (mbed add ...) dependencies = [l[:-4] for l in self.resources.lib_refs] # separate the individual dependency source files into a map with the dep name as key and an array if files - depSources = {re.sub(r'^[.]/', '', l): + depSources = {re.sub(r'^[.]/', '', l).replace('/', '_'): sorted([f for f in allSourceFiles if f.startswith(l)]) for l in dependencies} # delete dependencies that have no source files (may happen if a sub-dependency is ignored by .mbedignore) depSources = {k: v for k, v in depSources.items() if len(v) != 0}