diff options
-rw-r--r-- | src/cmake/cmake.d/03-macros.cmake | 49 |
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]") |