15
15
# R_VERSION (for win)
16
16
# R_ARCH (for win 64 when want 32 bit build)
17
17
#
18
- # TODO:
19
- # - someone to verify OSX detection,
18
+ # TODO:
19
+ # - someone to verify OSX detection,
20
20
# - possibly, add OSX detection based on current R in PATH or LIBR_EXECUTABLE
21
21
# - improve registry-based R_HOME detection in Windows (from a set of R_VERSION's)
22
22
@@ -37,8 +37,8 @@ endif()
37
37
# Creates R.lib and R.def in the build directory for linking with MSVC
38
38
function (create_rlib_for_msvc )
39
39
# various checks and warnings
40
- if (NOT WIN32 OR NOT MSVC )
41
- message (FATAL_ERROR "create_rlib_for_msvc() can only be used with MSVC" )
40
+ if (NOT WIN32 OR ( NOT MSVC AND NOT MINGW ) )
41
+ message (FATAL_ERROR "create_rlib_for_msvc() can only be used with MSVC or MINGW " )
42
42
endif ()
43
43
if (NOT EXISTS "${LIBR_LIB_DIR} " )
44
44
message (FATAL_ERROR "LIBR_LIB_DIR was not set!" )
@@ -90,15 +90,15 @@ if(APPLE)
90
90
set (LIBR_INCLUDE_DIRS "${LIBR_HOME} /include" CACHE PATH "R include directory" )
91
91
set (LIBR_LIB_DIR "${LIBR_HOME} /lib" CACHE PATH "R lib directory" )
92
92
endif ()
93
-
93
+
94
94
# detection for UNIX & Win32
95
95
else ()
96
96
97
97
# attempt to find R executable
98
98
if (NOT LIBR_EXECUTABLE )
99
99
find_program (LIBR_EXECUTABLE NAMES R R.exe )
100
100
endif ()
101
-
101
+
102
102
if (UNIX )
103
103
104
104
if (NOT LIBR_EXECUTABLE )
@@ -124,7 +124,7 @@ else()
124
124
125
125
# Windows
126
126
else ()
127
- # ask R for R_HOME
127
+ # ask R for R_HOME
128
128
if (LIBR_EXECUTABLE )
129
129
execute_process (
130
130
COMMAND ${LIBR_EXECUTABLE} "--slave" "--no-save" "-e" "cat(normalizePath(R.home(),winslash='/'))"
@@ -147,7 +147,7 @@ else()
147
147
# set other R paths based on home path
148
148
set (LIBR_INCLUDE_DIRS "${LIBR_HOME} /include" )
149
149
set (LIBR_LIB_DIR "${LIBR_HOME} /bin/${R_ARCH} " )
150
-
150
+
151
151
message (STATUS "LIBR_HOME [${LIBR_HOME} ]" )
152
152
message (STATUS "LIBR_EXECUTABLE [${LIBR_EXECUTABLE} ]" )
153
153
message (STATUS "LIBR_INCLUDE_DIRS [${LIBR_INCLUDE_DIRS} ]" )
@@ -158,7 +158,7 @@ message(STATUS "LIBR_CORE_LIBRARY [${LIBR_CORE_LIBRARY}]")
158
158
159
159
endif ()
160
160
161
- if (WIN32 AND MSVC )
161
+ if (( WIN32 AND MSVC ) OR ( WIN32 AND MINGW ) )
162
162
# create a local R.lib import library for R.dll if it doesn't exist
163
163
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR} /R.lib" )
164
164
create_rlib_for_msvc ()
0 commit comments