1
+ #
2
+ # Licensed under the Apache License v2.0 with LLVM Exceptions.
3
+ # See https://llvm.org/LICENSE.txt for license information.
4
+ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
+ #
6
+ # Copyright (c) 2024 Alan de Freitas ([email protected] )
7
+ #
8
+ # Official repository: https://github.com/cppalliance/mrdocs
9
+ #
10
+ #
11
+
12
+ #
13
+ # This file is derived from the CMakeLists.txt file in the Microsoft vcpkg repository:
14
+ # https://github.com/microsoft/vcpkg/blob/master/ports/duktape/CMakeLists.txt
15
+ #
16
+
17
+ cmake_minimum_required (VERSION 3.13)
18
+
19
+ set (duktape_MAJOR_VERSION 2)
20
+ set (duktape_MINOR_VERSION 7)
21
+ set (duktape_PATCH_VERSION 0)
22
+ set (duktape_VERSION ${duktape_MAJOR_VERSION} .${duktape_MINOR_VERSION} .${duktape_PATCH_VERSION} )
23
+
24
+ option (CMAKE_VERBOSE_MAKEFILE "Create verbose makefile" OFF )
25
+ option (BUILD_SHARED_LIBS "Create duktape as a shared library" OFF )
26
+
27
+ project (duktape VERSION ${duktape_VERSION} )
28
+
29
+ file (GLOB_RECURSE DUKTAPE_SOURCES "${CMAKE_CURRENT_LIST_DIR} /src/*.c" )
30
+ file (GLOB_RECURSE DUKTAPE_HEADERS "${CMAKE_CURRENT_LIST_DIR} /src/*.h" )
31
+
32
+ add_library (duktape ${DUKTAPE_SOURCES} ${DUKTAPE_HEADERS} )
33
+ target_include_directories (duktape PRIVATE "${CMAKE_CURRENT_LIST_DIR} /src" )
34
+ set_target_properties (duktape PROPERTIES PUBLIC_HEADER "${DUKTAPE_HEADERS} " )
35
+ set_target_properties (duktape PROPERTIES VERSION ${duktape_VERSION} )
36
+ set_target_properties (duktape PROPERTIES SOVERSION ${duktape_MAJOR_VERSION} )
37
+
38
+ if (BUILD_SHARED_LIBS )
39
+ target_compile_definitions (duktape PRIVATE -DDUK_F_DLL_BUILD)
40
+ endif ()
41
+
42
+ install (TARGETS duktape
43
+ EXPORT duktapeTargets
44
+ ARCHIVE DESTINATION "lib"
45
+ LIBRARY DESTINATION "lib"
46
+ RUNTIME DESTINATION "bin"
47
+ PUBLIC_HEADER DESTINATION "include"
48
+ COMPONENT dev
49
+ )
50
+
51
+ install (EXPORT duktapeTargets
52
+ FILE duktapeTargets.cmake
53
+ NAMESPACE duktape::
54
+ DESTINATION "share/duktape"
55
+ )
56
+
57
+ export (PACKAGE duktape)
58
+
59
+ include (CMakePackageConfigHelpers)
60
+ write_basic_package_version_file("${PROJECT_BINARY_DIR} /duktapeConfigVersion.cmake"
61
+ COMPATIBILITY SameMajorVersion
62
+ )
63
+
64
+ configure_file (duktapeConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY} /duktapeConfig.cmake" @ONLY)
65
+
66
+ install (FILES
67
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY} /duktapeConfig.cmake"
68
+ "${PROJECT_BINARY_DIR} /duktapeConfigVersion.cmake"
69
+ DESTINATION "share/duktape"
70
+ )
0 commit comments