diff --git a/build-support/custom-modules/ns3-module-macros.cmake b/build-support/custom-modules/ns3-module-macros.cmake index 614639c41..1e3e38a99 100644 --- a/build-support/custom-modules/ns3-module-macros.cmake +++ b/build-support/custom-modules/ns3-module-macros.cmake @@ -144,6 +144,15 @@ function(build_lib) foreach(library ${BLIB_LIBRARIES_TO_LINK}) remove_lib_prefix("${library}" module_name) + # Ignore the case where the library dependency name match the ns-3 module + # since it is most likely is due to brite, click and openflow collisions. + # All the ns-3 module targets should be prefixed with 'lib' to be + # differentiable. + if("${library}" STREQUAL "${BLIB_LIBNAME}") + list(APPEND non_ns_libraries_to_link ${library}) + continue() + endif() + # Check if the module exists in the ns-3 modules list or if it is a # 3rd-party library if(${module_name} IN_LIST ns3-all-enabled-modules) diff --git a/utils/tests/test-ns3.py b/utils/tests/test-ns3.py index 8be19de99..e0fc56d87 100755 --- a/utils/tests/test-ns3.py +++ b/utils/tests/test-ns3.py @@ -2320,6 +2320,24 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): return_code, stdout, stderr = run_program("test.py", "-p ./examples/wireless/mixed-wired-wireless", python=True) self.assertEqual(return_code, 0) + def test_13_FetchOptionalComponents(self): + """! + Test if we had regressions with brite, click and openflow modules + that depend on homonymous libraries + @return None + """ + if shutil.which("git") is None: + self.skipTest("Missing git") + + # First enable automatic components fetching + return_code, stdout, stderr = run_ns3("configure -- -DNS3_FETCH_OPTIONAL_COMPONENTS=ON") + self.assertEqual(return_code, 0) + + # Build the optional components to check if their dependencies were fetched + # and there were no build regressions + return_code, stdout, stderr = run_ns3("build brite click openflow") + self.assertEqual(return_code, 0) + class NS3ExpectedUseTestCase(NS3BaseTestCase): """!