Skip to content

Commit

Permalink
fix R paths
Browse files Browse the repository at this point in the history
goulart-paul committed Apr 13, 2018
1 parent c652fa0 commit 8659950
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions configure/cmake/FindR.cmake
Original file line number Diff line number Diff line change
@@ -6,26 +6,25 @@
# R_ROOT_DIR - the R root directory
# R_INCLUDE_DIRS - the R include directories

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_FIND_APPBUNDLE "LAST")
endif()

set(TEMP_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
set(CMAKE_FIND_APPBUNDLE "NEVER")
find_program(R_EXEC NAMES R R.exe)
set(CMAKE_FIND_APPBUNDLE ${TEMP_CMAKE_FIND_APPBUNDLE})


#---Find includes and libraries if R exists
if(R_EXEC)

set(R_FOUND TRUE)

EXECUTE_PROCESS(
COMMAND "${R_EXEC}" "--slave" "--no-save" "-e" "cat(R.home())"
OUTPUT_VARIABLE R_ROOT_DIR)

execute_process(WORKING_DIRECTORY .
COMMAND ${R_EXEC} RHOME
OUTPUT_VARIABLE R_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)

find_path(R_INCLUDE_DIRS R.h
HINTS ${R_ROOT_DIR}
PATHS /usr/local/lib /usr/local/lib64 /usr/share
PATH_SUFFIXES include R/include)
PATHS /usr/local/lib /usr/local/lib64 /usr/share /usr/include ${R_ROOT_DIR} PATH_SUFFIXES include R R/include)

endif()

mark_as_advanced(R_FOUND R_EXEC R_ROOT_DIR R_INCLUDE_DIRS)

0 comments on commit 8659950

Please sign in to comment.