We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c67c281 commit 6d22952Copy full SHA for 6d22952
cmake/FindR.cmake
@@ -7,8 +7,26 @@
7
# R_INCLUDE_DIR - the R include directory
8
# R_LIBRARIES - Link these to use R
9
10
+# Check if R_HOME is defined in the environment
11
+MACRO(SUBDIRLIST result curdir)
12
+ FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
13
+ SET(dirlist "")
14
+ FOREACH(child ${children})
15
+ IF(IS_DIRECTORY ${curdir}/${child})
16
+ LIST(APPEND dirlist ${curdir}/${child})
17
+ ENDIF()
18
+ ENDFOREACH()
19
+ SET(${result} ${dirlist})
20
+ENDMACRO()
21
+
22
# find the R binary
-FIND_PROGRAM(R_EXECUTABLE R)
23
+SET(R_HOME $ENV{R_HOME})
24
+IF(R_HOME)
25
+ SUBDIRLIST(SUBDIRS ${R_HOME})
26
+ FIND_PROGRAM(R_EXECUTABLE R HINTS SUBDIRS)
27
+ELSE()
28
+ FIND_PROGRAM(R_EXECUTABLE R)
29
+ENDIF()
30
31
SET(ABORT_CONFIG FALSE)
32
IF(R_EXECUTABLE)
0 commit comments