File tree 1 file changed +26
-5
lines changed
1 file changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -110,11 +110,32 @@ def static isMusl() {
110
110
111
111
ext. hasGtest = false
112
112
113
- // This is hardcoded - we could have some discovery mechanism here but it would mean forking to shell
114
- if (os(). isMacOsX() && file(' /opt/homebrew/opt/googletest' ). exists()) {
115
- ext. hasGtest = true
116
- } else if (os(). isLinux() && file(' /usr/include/gtest' ). exists()) {
117
- ext. hasGtest = true
113
+ // Define potential GTest locations for MacOS and Linux
114
+ def gtestLocations = [
115
+ macos : [' /opt/homebrew/opt/googletest' , ' /usr/local/opt/googletest' ],
116
+ linux : [' /usr/include/gtest' , ' /usr/local/include/gtest' ]
117
+ ]
118
+
119
+ // Function to check if any of the specified paths exist
120
+ def checkGtestPaths (paths ) {
121
+ for (path in paths) {
122
+ if (file(path). exists()) {
123
+ return true
124
+ }
125
+ }
126
+ return false
127
+ }
128
+
129
+ // Determine OS and check for GTest
130
+ if (os(). isMacOsX()) {
131
+ ext. hasGtest = checkGtestPaths(gtestLocations. macos)
132
+ } else if (os(). isLinux()) {
133
+ ext. hasGtest = checkGtestPaths(gtestLocations. linux)
134
+ }
135
+
136
+ // Log a message for debugging
137
+ if (! ext. hasGtest) {
138
+ println " GTest not found. Please install GTest or configure paths."
118
139
}
119
140
120
141
ext {
You can’t perform that action at this time.
0 commit comments