This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/real/CMakeLists.txt
2017-12-13 16:56:10 +00:00

75 lines
1.9 KiB
CMake

# PROJECT ( YAP_REAL C )
#
# - This module locates an installed R distribution.
#
# Defines the following:
# R_COMMAND - Path to R command
# R_HOME - Path to 'R home', as reported by R
# R_INCLUDE_DIR - Path to R include directory
# R_LIBRARY_BASE - Path to R library
# R_LIBRARY_BLAS - Path to Rblas / blas library
# R_LIBRARY_LAPACK - Path to Rlapack / lapack library
# R_LIBRARY_READLINE - Path to readline library
# R_LIBRARIES - Array of: R_LIBRARY_BASE, R_LIBRARY_BLAS, R_LIBRARY_LAPACK, R_LIBRARY_BASE [, R_LIBRARY_READLINE]
#
# VTK_R_HOME - (deprecated, use R_HOME instead) Path to 'R home', as reported by R
#
# Variable search order:
# 1. Attempt to locate and set R_COMMAND
# - If unsuccessful, generate error and prompt user to manually set R_COMMAND
# 2. Use R_COMMAND to set R_HOME
# 3. Locate other libraries in the priority:
# 1. Within a user-built instance of R at R_HOME
# 2. Within an installed instance of R
# 3. Within external system libraries
#
macro_optional_find_package (R ON)
if (R_LIBRARIES AND R_INCLUDE_DIR)
set (REAL_SOURCES
real.c
)
set (REAL_PL
real.pl
)
add_to_group( REAL_PL pl_library)
include_directories (
${CMAKE_CURRENT_BINARY_DIR}
${R_INCLUDE_DIR}
)
list (APPEND CMAKE_REQUIRED_INCLUDES
${CMAKE_CURRENT_BINARY_DIR}
${R_INCLUDE_DIR}
)
add_lib(real ${REAL_SOURCES})
target_link_libraries (real ${R_LIBRARIES} libYap)
check_include_files( "stdio.h;R.h" HAVE_R_H )
check_include_files( "R.h;Rembedded.h" HAVE_R_EMBEDDED_H )
check_include_files( "Rembedded.h;Rinterface.h" HAVE_R_INTERFACE_H )
configure_file ("rconfig.h.cmake" "rconfig.h" )
install(TARGETS real
RUNTIME DESTINATION ${YAP_INSTALL_DLLDIR}
ARCHIVE DESTINATION ${YAP_INSTALL_DLLDIR}
LIBRARY DESTINATION ${YAP_INSTALL_DLLDIR}
)
install(FILES real.pl
DESTINATION ${libpl}
)
endif()