1#.rst:
2# Find Node.js
3# ------------
4#
5# Finds the Node.js executable. This module defines:
6#
7#  NodeJs_FOUND         - True if Node.js executable is found
8#  NodeJs::NodeJs       - Node.js executable imported target
9#
10
11#
12#   This file is part of Corrade.
13#
14#   Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
15#               2017, 2018, 2019 Vladimír Vondruš <mosra@centrum.cz>
16#
17#   Permission is hereby granted, free of charge, to any person obtaining a
18#   copy of this software and associated documentation files (the "Software"),
19#   to deal in the Software without restriction, including without limitation
20#   the rights to use, copy, modify, merge, publish, distribute, sublicense,
21#   and/or sell copies of the Software, and to permit persons to whom the
22#   Software is furnished to do so, subject to the following conditions:
23#
24#   The above copyright notice and this permission notice shall be included
25#   in all copies or substantial portions of the Software.
26#
27#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28#   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
30#   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31#   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
32#   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
33#   DEALINGS IN THE SOFTWARE.
34#
35
36find_program(NODEJS_EXECUTABLE node)
37mark_as_advanced(NODEJS_EXECUTABLE)
38
39include(FindPackageHandleStandardArgs)
40find_package_handle_standard_args("NodeJs" DEFAULT_MSG NODEJS_EXECUTABLE)
41
42if(NOT TARGET NodeJs::NodeJs)
43    add_executable(NodeJs::NodeJs IMPORTED)
44    set_property(TARGET NodeJs::NodeJs PROPERTY IMPORTED_LOCATION ${NODEJS_EXECUTABLE})
45endif()
46