Commits

Liam Devine committed 93f8906

Incorrect relative paths for gmake sibling static libraries

Comments (0)

Files changed (3)

 * Patch 3043933 Allow gmake to use static lib when shared lib of same name exists (Jonathan Derque)
 * Bug 3294459: vs10 x86_64 using incorrect debug format for minimal rebuild (learner)
 * Bug 3297634: Special characters in directory name Xcode3 (jdale)
-
+* Bug 3308203: Incorrect relative paths for gmake sibling static libraries (Adam)
 -------
   4.3
 -------

src/tools/gcc.lua

 				local pathstyle = premake.getpathstyle(value)
 				local namestyle = premake.getnamestyle(value)
 				local linktarget = premake.gettarget(value, "link",  pathstyle, namestyle, cfg.system)
-				table.insert(result, linktarget.fullpath)
+				local rebasedpath = path.rebase(linktarget.fullpath, value.location, cfg.location)
+				table.insert(result, rebasedpath)
 			else
 				--premake does not support creating frameworks so this is just a SharedLib link
 				--link using -lname

tests/actions/make/test_make_linking.lua

 		test.string_contains(buffer,format_exspected)
 	end
 	
+	function T.link_suite.projectLinksToStaticPremakeMadeLibrary_projectDifferInDirectoryHeights_linksUsingCorrectRelativePath()
 	
+		firstProject = project 'firstProject'
+			kind 'StaticLib'
+			language 'C'
+
+		linksToFirstProject = project 'linksToFirstProject'
+			kind 'ConsoleApp'
+			language 'C'
+			links{'firstProject'}
+			location './foo/bar'
+			
+		local buffer = get_buffer(linksToFirstProject)
+		local format_exspected = 'LIBS      %+%= ../../libfirstProject.a'
+		test.string_contains(buffer,format_exspected)
+	end
+