Skip to content

Commit 3bc85ba

Browse files
committed
visp: test cmake functionality in test block
1 parent 64fad35 commit 3bc85ba

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Formula/v/visp.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Visp < Formula
1919
sha256 cellar: :any_skip_relocation, x86_64_linux: "5f55415e96b2adca09e489d64b8399f9b14961939f8b0d5b9895ddff1c7f50f9"
2020
end
2121

22-
depends_on "cmake" => :build
22+
depends_on "cmake" => [:build, :test]
2323
depends_on "pkgconf" => [:build, :test]
2424

2525
depends_on "eigen"
@@ -164,5 +164,19 @@ def install
164164
pkg_config_flags = shell_output("pkgconf --cflags --libs visp").chomp.split
165165
system ENV.cxx, "test.cpp", "-o", "test", *pkg_config_flags
166166
assert_equal version.to_s, shell_output("./test").chomp
167+
168+
ENV.delete "CPATH"
169+
(testpath/"CMakeLists.txt").write <<~CMAKE
170+
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
171+
project(visp-check)
172+
find_package(VISP REQUIRED)
173+
include_directories(${VISP_INCLUDE_DIRS})
174+
add_executable(visp-check test.cpp)
175+
target_link_libraries(visp-check ${VISP_LIBRARIES})
176+
CMAKE
177+
178+
system "cmake", "-B", "build", "-S", "."
179+
system "cmake", "--build", "build"
180+
assert_equal version.to_s, shell_output("build/visp-check").chomp
167181
end
168182
end

0 commit comments

Comments
 (0)