keg: explicitly create cmake dir under lib

Packages supporting CMake may install configuration files for use
with CMake's find_package command. A recommended location for these
is `<prefix>/lib/cmake` which is not unique across packages. This
may cause issues for Formula using this location when their Keg
is linked.

As with pkg-config, explicitly create the `lib/cmake` folder when
linking a Keg that has installed folders/files to this location.

Also add testcase.

Closes Homebrew/homebrew#38005.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Ben Morgan 2015-03-23 16:38:13 +00:00 committed by Xu Cheng
parent 8f8061e5f8
commit 1795599d88
2 changed files with 9 additions and 0 deletions

View File

@ -278,6 +278,8 @@ class Keg
when 'charset.alias' then :skip_file
# pkg-config database gets explicitly created
when 'pkgconfig' then :mkpath
# cmake database gets explicitly created
when 'cmake' then :mkpath
# lib/language folders also get explicitly created
when 'dtrace' then :mkpath
when /^gdk-pixbuf/ then :mkpath

View File

@ -207,6 +207,13 @@ class LinkTests < Homebrew::TestCase
assert_predicate link.lstat, :directory?
end
def test_cmake_is_mkpathed
link = HOMEBREW_PREFIX.join("lib", "cmake")
@keg.join("lib", "cmake").mkpath
@keg.link
assert_predicate link.lstat, :directory?
end
def test_symlinks_are_linked_directly
link = HOMEBREW_PREFIX.join("lib", "pkgconfig")