if(WIN32)
  set(MOZJS_INCLUDE_DIR  "MOZJS_INCLUDE_DIR-NOTFOUND"  CACHE PATH "Path to the MOZJS include directory")
  set(MOZJS_LIBRARIES    "MOZJS_LIBRARIES-NOTFOUND"    CACHE FILEPATH "Path to the MOZJS .lib file")
  if(MOZJS_LIBRARIES AND MOZJS_INCLUDE_DIR)
    set(MOZJS_FOUND 1)
    link_directories(MOZJS_LIBRARIES)
    include_directories("${MOZJS_INCLUDE_DIR}")
  endif()
elseif(NOT APPLE)
  option(WITH_MOZJS "Search for MOZJS package" ON)
  if (WITH_MOZJS)
    pkg_search_module(MOZJS mozjs-52)
    if(MOZJS_FOUND)
      include_directories(${MOZJS_INCLUDE_DIRS})
      link_directories(${MOZJS_LIBRARY_DIRS})
    else()
      set(MOZJS_FOUND 0)
    endif()
  else()
    set(MOZJS_FOUND 0)
  endif()
endif()
