Skip to content

Instantly share code, notes, and snippets.

@wush978
Created January 29, 2013 08:03
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wush978/4662585 to your computer and use it in GitHub Desktop.
CMakeLists.txt for Rcpp Package Project
cmake_minimum_required(VERSION 2.8)
project(RcppPackage)
find_package(LibR)
if(${LIBR_FOUND})
else()
message(FATAL_ERROR "No R...")
endif()
message(STATUS ${CMAKE_SOURCE_DIR})
execute_process(
COMMAND ${LIBR_EXECUTABLE} "--slave" "-e" "stopifnot(require('Rcpp'));cat(Rcpp:::Rcpp.system.file('include'))"
OUTPUT_VARIABLE LIBRCPP_INCLUDE_DIRS
)
include_directories(BEFORE ${LIBR_INCLUDE_DIRS})
message(STATUS ${LIBR_INCLUDE_DIRS})
include_directories(BEFORE ${LIBRCPP_INCLUDE_DIRS})
message(STATUS ${LIBRCPP_INCLUDE_DIRS})
add_custom_target(RcppPackage ALL
COMMAND find ${CMAKE_SOURCE_DIR} -name "*.o" -exec rm "{}" "\;"
COMMAND find ${CMAKE_SOURCE_DIR} -name "*.so" -exec rm "{}" "\;"
COMMAND ${LIBR_EXECUTABLE} "--slave" "-e" "\"stopifnot(require(roxygen2));roxygenize('${CMAKE_SOURCE_DIR}',roclets=c('rd','collate','namespace'))\""
COMMAND ${LIBR_EXECUTABLE} CMD INSTALL "${CMAKE_SOURCE_DIR}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment