Verified Commit 2251c60c authored by Flavien BRIDAULT-LOUCHEZ's avatar Flavien BRIDAULT-LOUCHEZ
Browse files

enh(build): forbid link with a module

parent 51096049
......@@ -738,11 +738,6 @@ macro(fwModule SIGHT_TARGET TARGET_TYPE)
set_target_properties(${SIGHT_TARGET} PROPERTIES SIGHT_MODULE_RC_DIR "\${_IMPORT_PREFIX}/${SIGHT_MODULE_RC_PREFIX}/${SIGHT_TARGET}")
set_target_properties(${SIGHT_TARGET} PROPERTIES EXPORT_PROPERTIES "SIGHT_TARGET_TYPE;SIGHT_START;SIGHT_MODULE_RC_DIR;SIGHT_MODULE_DEPENDENCIES")
if(${SIGHT_TARGET}_MODULE_DEPENDENCIES)
message(WARNING "Module ${SIGHT_TARGET} links with other modules (${${SIGHT_TARGET}_MODULE_DEPENDENCIES}), "
"this feature will be removed in version 21.0 of Sight")
endif()
endmacro()
function(getPchTarget TARGET TARGET_DIR TYPE PCH OBJECT_LIBRARY)
......@@ -1138,4 +1133,23 @@ function(sight_generate_component_list COMPONENTS)
message(STATUS "${PROJECT_NAME} component list: ${SIGHT_ORDERED_COMPONENTS}")
set(COMPONENTS "${SIGHT_ORDERED_COMPONENTS}" PARENT_SCOPE)
endfunction()
\ No newline at end of file
# Check before leaving: a library or a module can not link with a module (a plugin is a leaf in the build tree)
foreach(COMPONENT ${SIGHT_ORDERED_COMPONENTS})
get_target_property(TYPE ${COMPONENT} SIGHT_TARGET_TYPE)
if("${TYPE}" STREQUAL "MODULE" OR "${TYPE}" STREQUAL "LIBRARY")
get_target_property(DEPENDS ${COMPONENT} LINK_LIBRARIES)
foreach(DEP ${DEPENDS})
if(TARGET ${DEP})
get_target_property(TYPE ${DEP} SIGHT_TARGET_TYPE)
if("${TYPE}" STREQUAL "MODULE")
string(APPEND MODULES_ERROR " ${DEP}")
endif()
endif()
endforeach()
if(MODULES_ERROR)
message(FATAL_ERROR "${COMPONENT} can not link with module(s): ${MODULES_ERROR}")
endif()
endif()
endforeach(COMPONENT ${SIGHT_ORDERED_COMPONENTS})
endfunction()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment