summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-12-11 11:04:44 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-11 11:04:44 +0100
commitc815f74207220e5e571fece7cbad00b7a39ae8c9 (patch)
treef3a3456b176ac5c7db3b19368abff40c26b0560c
parent95c24799c0e68009d1a285d8c370cd7b5c0ed47f (diff)
Link with defined project libraries dependencies
Link with defined project libraries dependencies by default. This will avoid the user to have to specify this again at target level, in addition of project level in the "config.cmake" file. Bug-AGL: SPEC-1997 Change-Id: Ib0933a8eb9259d27c095d18a0dbb5a269d6b0369 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--src/cmake/cmake.d/03-macros.cmake49
1 files changed, 30 insertions, 19 deletions
diff --git a/src/cmake/cmake.d/03-macros.cmake b/src/cmake/cmake.d/03-macros.cmake
index ff240cd..6aad674 100644
--- a/src/cmake/cmake.d/03-macros.cmake
+++ b/src/cmake/cmake.d/03-macros.cmake
@@ -357,9 +357,19 @@ macro(project_targets_populate)
foreach(TARGET ${PROJECT_TARGETS})
# Declaration of a custom command that will populate widget tree with the target
set(POPULE_PACKAGE_TARGET "project_populate_${TARGET}")
- get_target_property(T ${TARGET} LABELS)
+ get_target_property(TYPE ${TARGET} TYPE)
- if(T)
+ if(${TYPE} STREQUAL "STATIC_LIBRARY" OR
+ ${TYPE} STREQUAL "MODULE_LIBRARY" OR
+ ${TYPE} STREQUAL "SHARED_LIBRARY" OR
+ ${TYPE} STREQUAL "INTERFACE_LIBRARY" OR
+ ${TYPE} STREQUAL "EXECUTABLE"
+ )
+ set_property(TARGET ${TARGET} APPEND PROPERTY LINK_LIBRARIES ${link_libraries})
+ endif()
+
+ get_target_property(SUBTYPE ${TARGET} LABELS)
+ if(SUBTYPE)
get_target_property(P ${TARGET} PREFIX)
get_target_property(S ${TARGET} SUFFIX)
get_target_property(BD ${TARGET} BINARY_DIR)
@@ -369,9 +379,10 @@ macro(project_targets_populate)
if(OUT MATCHES "NOTFOUND$")
set(OUT ${TARGET})
endif()
+
if(P MATCHES "NOTFOUND$")
- if (${T} STREQUAL "LIBRARY" OR
- ${T} MATCHES "^BINDINGV?.?$")
+ if (${SUBTYPE} STREQUAL "LIBRARY" OR
+ ${SUBTYPE} MATCHES "^BINDINGV?.?$")
set(P "lib")
else()
set(P "")
@@ -379,23 +390,23 @@ macro(project_targets_populate)
endif()
get_target_property(IMPPATH ${TARGET} IMPORTED_LOCATION)
- if(${T} STREQUAL "LIBRARY")
+ if(${SUBTYPE} STREQUAL "LIBRARY")
unset(BD)
generate_one_populate_target(${IMPPATH} ${PACKAGE_LIBDIR})
- elseif(${T} STREQUAL "TEST-LIBRARY")
+ elseif(${SUBTYPE} STREQUAL "TEST-LIBRARY")
unset(BD)
generate_one_populate_target(${IMPPATH} ${PACKAGE_TEST_LIBDIR})
- elseif(${T} STREQUAL "PLUGIN")
+ elseif(${SUBTYPE} STREQUAL "PLUGIN")
if(NOT S)
set(S ".ctlso")
endif()
generate_one_populate_target(${P}${OUT}${S} "${PACKAGE_LIBDIR}/plugins")
- elseif(${T} STREQUAL "TEST-PLUGIN")
+ elseif(${SUBTYPE} STREQUAL "TEST-PLUGIN")
if(NOT S)
set(S ".ctlso")
endif()
generate_one_populate_target(${P}${OUT}${S} "${PACKAGE_TEST_LIBDIR}/plugins")
- elseif(${T} STREQUAL "BINDING")
+ elseif(${SUBTYPE} STREQUAL "BINDING")
if(NOT S)
set(S ".so")
endif()
@@ -404,7 +415,7 @@ macro(project_targets_populate)
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
LINK_FLAGS ${BINDINGS_LINK_FLAG}
)
- elseif(${T} STREQUAL "BINDINGV2")
+ elseif(${SUBTYPE} STREQUAL "BINDINGV2")
if(NOT S)
set(S ".so")
endif()
@@ -413,7 +424,7 @@ macro(project_targets_populate)
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
LINK_FLAGS ${BINDINGS_LINK_FLAG}
)
- elseif(${T} STREQUAL "BINDINGV3")
+ elseif(${SUBTYPE} STREQUAL "BINDINGV3")
if(NOT S)
set(S ".so")
endif()
@@ -422,7 +433,7 @@ macro(project_targets_populate)
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
LINK_FLAGS ${BINDINGS_LINK_FLAG}
)
- elseif(${T} STREQUAL "EXECUTABLE")
+ elseif(${SUBTYPE} STREQUAL "EXECUTABLE")
if(NOT S)
set(S "")
endif()
@@ -432,7 +443,7 @@ macro(project_targets_populate)
else()
generate_one_populate_target(${P}${OUT}${S} ${PACKAGE_BINDIR})
endif()
- elseif(${T} STREQUAL "TEST-EXECUTABLE")
+ elseif(${SUBTYPE} STREQUAL "TEST-EXECUTABLE")
if(NOT S)
set(S "")
endif()
@@ -442,17 +453,17 @@ macro(project_targets_populate)
else()
generate_one_populate_target(${P}${OUT}${S} ${PACKAGE_TEST_BINDIR})
endif()
- elseif(${T} STREQUAL "HTDOCS")
+ elseif(${SUBTYPE} STREQUAL "HTDOCS")
generate_one_populate_target(${P}${OUT} ${PACKAGE_HTTPDIR})
- elseif(${T} STREQUAL "TEST-HTDOCS")
+ elseif(${SUBTYPE} STREQUAL "TEST-HTDOCS")
generate_one_populate_target(${P}${OUT} ${PACKAGE_HTTPDIR})
- elseif(${T} STREQUAL "DATA" )
+ elseif(${SUBTYPE} STREQUAL "DATA" )
generate_one_populate_target(${TARGET} ${PACKAGE_DATADIR})
- elseif(${T} STREQUAL "TEST-DATA")
+ elseif(${SUBTYPE} STREQUAL "TEST-DATA")
generate_one_populate_target(${TARGET} ${PACKAGE_TEST_DATADIR})
- elseif(${T} STREQUAL "BINDING-CONFIG" )
+ elseif(${SUBTYPE} STREQUAL "BINDING-CONFIG" )
generate_one_populate_target(${TARGET} ${PACKAGE_ETCDIR})
- elseif(${T} STREQUAL "TEST-CONFIG")
+ elseif(${SUBTYPE} STREQUAL "TEST-CONFIG")
generate_one_populate_target(${TARGET} ${PACKAGE_TEST_ETCDIR})
endif()
elseif("${CMAKE_BUILD_TYPE}" MATCHES "[Dd][Ee][Bb][Uu][Gg]")