Files
MapLibreParticleLab/cmake/npm.cmake
Konstantin Käfer 692fe1f3ff [build] switch to CMake
This is very much a work in progress.
2016-08-05 11:42:22 +02:00

21 lines
766 B
CMake

function(cache_executable_path name variable)
# Obtain paths to node and npm and cache it, so when e.g. Xcode reruns CMake, we still have the
# variables from the original invocation
if(NOT ${variable})
set(_which_output)
execute_process(
COMMAND which ${name}
OUTPUT_VARIABLE _which_output
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(_which_output STREQUAL "")
message(STATUS "Using cached ${name}: ${${variable}}")
else()
set(${variable} "${_which_output}" CACHE PATH "Path to ${name} executable")
message(STATUS "Using ${name}: ${${variable}}")
endif()
endif()
endfunction()
cache_executable_path(node _node)
cache_executable_path(npm _npm)