diff options
author | Randall Lee <randall.lee@mapbox.com> | 2018-05-22 14:09:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-22 14:09:36 -0400 |
commit | d858cb783b499a1cc77b48a0faee137ca5e6a423 (patch) | |
tree | 5c36c353730e3050d44e472545519c0429723266 /cmake/mbgl.cmake | |
parent | f93d722458be62d567aa152711a014ef51a90193 (diff) | |
parent | 60505b03174b5ec02ae723beafa7683f6ed54a62 (diff) | |
download | qtlocation-mapboxgl-upstream/rclee-async-setup.tar.gz |
Merge branch 'master' into rclee-async-setupupstream/rclee-async-setup
Diffstat (limited to 'cmake/mbgl.cmake')
-rw-r--r-- | cmake/mbgl.cmake | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake index f087c32511..88e24e3536 100644 --- a/cmake/mbgl.cmake +++ b/cmake/mbgl.cmake @@ -17,12 +17,32 @@ if(WITH_NODEJS) message(FATAL_ERROR "Could not find npm") endif() + execute_process( + COMMAND "${NodeJS_EXECUTABLE}" -e "process.stdout.write(process.versions.node)" + RESULT_VARIABLE _STATUS_CODE + OUTPUT_VARIABLE NodeJS_VERSION + ERROR_VARIABLE _STATUS_MESSAGE + ) + if(NOT _STATUS_CODE EQUAL 0) + message(FATAL_ERROR "Could not detect Node.js version: ${_STATUS_MESSAGE}") + endif() + + execute_process( + COMMAND "${NodeJS_EXECUTABLE}" -e "process.stdout.write(process.versions.modules)" + RESULT_VARIABLE _STATUS_CODE + OUTPUT_VARIABLE NodeJS_ABI + ERROR_VARIABLE _STATUS_MESSAGE + ) + if(NOT _STATUS_CODE EQUAL 0) + message(FATAL_ERROR "Could not detect Node.js ABI version: ${_STATUS_MESSAGE}") + endif() + function(_npm_install DIRECTORY NAME ADDITIONAL_DEPS) SET(NPM_INSTALL_FAILED FALSE) if("${DIRECTORY}/package.json" IS_NEWER_THAN "${DIRECTORY}/node_modules/.${NAME}.stamp") message(STATUS "Running 'npm install' for ${NAME}...") execute_process( - COMMAND ${NodeJS_EXECUTABLE} ${npm_EXECUTABLE} install --ignore-scripts + COMMAND "${NodeJS_EXECUTABLE}" "${npm_EXECUTABLE}" install --ignore-scripts WORKING_DIRECTORY "${DIRECTORY}" RESULT_VARIABLE NPM_INSTALL_FAILED) if(NOT NPM_INSTALL_FAILED) @@ -32,7 +52,7 @@ if(WITH_NODEJS) add_custom_command( OUTPUT "${DIRECTORY}/node_modules/.${NAME}.stamp" - COMMAND ${NodeJS_EXECUTABLE} ${npm_EXECUTABLE} install --ignore-scripts + COMMAND "${NodeJS_EXECUTABLE}" "${npm_EXECUTABLE}" install --ignore-scripts COMMAND ${CMAKE_COMMAND} -E touch "${DIRECTORY}/node_modules/.${NAME}.stamp" WORKING_DIRECTORY "${DIRECTORY}" DEPENDS ${ADDITIONAL_DEPS} "${DIRECTORY}/package.json" @@ -72,7 +92,12 @@ endif() # Generate source groups so the files are properly sorted in IDEs like Xcode. function(create_source_groups target) - get_target_property(sources ${target} SOURCES) + get_target_property(type ${target} TYPE) + if(type AND type STREQUAL "INTERFACE_LIBRARY") + get_target_property(sources ${target} INTERFACE_SOURCES) + else() + get_target_property(sources ${target} SOURCES) + endif() foreach(file ${sources}) get_filename_component(file "${file}" ABSOLUTE) string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" group "${file}") |