diff --git a/build-support/custom-modules/ns3-versioning.cmake b/build-support/custom-modules/ns3-versioning.cmake index bab109c13..84b646011 100644 --- a/build-support/custom-modules/ns3-versioning.cmake +++ b/build-support/custom-modules/ns3-versioning.cmake @@ -180,7 +180,7 @@ function(configure_embedded_version) # If value is empty, replace with an empty string, assume its the release # candidate string - if(NOT varvalue) + if((NOT varvalue) AND (NOT varvalue STREQUAL "0")) set(varvalue "\"\"") endif() diff --git a/utils/tests/test-ns3.py b/utils/tests/test-ns3.py index d132e31bc..c10078ab8 100644 --- a/utils/tests/test-ns3.py +++ b/utils/tests/test-ns3.py @@ -1412,6 +1412,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Configuration should now succeed container.execute("./ns3 clean") container.execute("./ns3 configure -G Ninja --enable-build-version") + container.execute("./ns3 build core") self.assertTrue(os.path.exists(os.path.join(ns3_path, "cmake-cache", "build.ninja"))) # And contents of version cache should be unchanged @@ -1426,6 +1427,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): container.execute("apt-get install -y git") container.execute("./ns3 clean") container.execute("./ns3 configure -G Ninja --enable-build-version") + container.execute("./ns3 build core") except Exception: pass os.rename(os.path.join(ns3_path, "temp_git"), os.path.join(ns3_path, ".git")) @@ -1434,6 +1436,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Fourth case: test with Git and git history. Now the version.cache should be replaced. container.execute("./ns3 clean") container.execute("./ns3 configure -G Ninja --enable-build-version") + container.execute("./ns3 build core") self.assertTrue(os.path.exists(os.path.join(ns3_path, "cmake-cache", "build.ninja"))) with open(version_cache_file, "r") as version: self.assertNotEqual(version.read(), version_cache_contents)