cmake_minimum_required(VERSION 3.9) cmake_policy(SET CMP0042 NEW) project (image) include_directories(${CMAKE_JS_INC}) file(GLOB SOURCE_FILES "natives/*.cc" "natives/*.h") add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node") target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB}) set(CMAKE_CXX_STANDARD 17) add_definitions(-DNAPI_CPP_EXCEPTIONS) add_definitions(-DNAPI_VERSION=3) execute_process(COMMAND node -p "require('node-addon-api').include" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE NODE_ADDON_API_DIR ) string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR}) string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR}) target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR}) find_package(ImageMagick COMPONENTS Magick++) add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16) add_definitions(-DMAGICKCORE_HDRI_ENABLE=0) include_directories(${ImageMagick_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} ${ImageMagick_LIBRARIES})