2020-02-05 03:32:03 +08:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2019-08-17 08:22:04 +08:00
|
|
|
|
2017-07-14 19:37:25 +01:00
|
|
|
|
2019-10-07 19:35:13 +02:00
|
|
|
set(duktape_MAJOR_VERSION 2)
|
|
|
|
set(duktape_MINOR_VERSION 4)
|
|
|
|
set(duktape_PATCH_VERSION 0)
|
|
|
|
set(duktape_VERSION ${duktape_MAJOR_VERSION}.${duktape_MINOR_VERSION}.${duktape_PATCH_VERSION})
|
2017-07-14 19:37:25 +01:00
|
|
|
|
2019-10-07 19:35:13 +02:00
|
|
|
option(CMAKE_VERBOSE_MAKEFILE "Create verbose makefile" OFF)
|
|
|
|
option(BUILD_SHARED_LIBS "Create duktape as a shared library" ON)
|
|
|
|
|
|
|
|
project(duktape VERSION ${duktape_VERSION})
|
2017-07-14 19:37:25 +01:00
|
|
|
|
2019-10-07 19:35:13 +02:00
|
|
|
file(GLOB_RECURSE DUKTAPE_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*.c")
|
|
|
|
file(GLOB_RECURSE DUKTAPE_HEADERS "${CMAKE_CURRENT_LIST_DIR}/src/*.h")
|
2019-05-02 22:57:43 -07:00
|
|
|
|
2017-07-14 21:36:48 +01:00
|
|
|
add_library(duktape ${DUKTAPE_SOURCES} ${DUKTAPE_HEADERS})
|
2019-10-07 19:35:13 +02:00
|
|
|
target_include_directories(duktape PRIVATE "${CMAKE_CURRENT_LIST_DIR}/src")
|
|
|
|
set_target_properties(duktape PROPERTIES PUBLIC_HEADER "${DUKTAPE_HEADERS}")
|
2020-11-25 13:25:02 -06:00
|
|
|
set_target_properties(duktape PROPERTIES VERSION ${duktape_VERSION})
|
|
|
|
set_target_properties(duktape PROPERTIES SOVERSION ${duktape_MAJOR_VERSION})
|
2017-07-14 19:37:25 +01:00
|
|
|
|
2019-10-07 19:35:13 +02:00
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
target_compile_definitions(duktape PRIVATE -DDUK_F_DLL_BUILD)
|
|
|
|
endif ()
|
2017-07-14 21:36:48 +01:00
|
|
|
|
|
|
|
install(TARGETS duktape
|
2019-10-07 19:35:13 +02:00
|
|
|
EXPORT duktapeTargets
|
2017-07-14 19:37:25 +01:00
|
|
|
ARCHIVE DESTINATION "lib"
|
2019-10-07 19:35:13 +02:00
|
|
|
LIBRARY DESTINATION "lib"
|
2017-07-14 19:37:25 +01:00
|
|
|
RUNTIME DESTINATION "bin"
|
2019-10-07 19:35:13 +02:00
|
|
|
PUBLIC_HEADER DESTINATION "include"
|
|
|
|
COMPONENT dev
|
|
|
|
)
|
|
|
|
|
|
|
|
install(EXPORT duktapeTargets
|
|
|
|
FILE duktapeTargets.cmake
|
|
|
|
NAMESPACE duktape::
|
|
|
|
DESTINATION "share/duktape"
|
|
|
|
)
|
|
|
|
|
|
|
|
export(PACKAGE duktape)
|
|
|
|
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
write_basic_package_version_file("${PROJECT_BINARY_DIR}/duktapeConfigVersion.cmake"
|
|
|
|
COMPATIBILITY SameMajorVersion
|
|
|
|
)
|
|
|
|
|
|
|
|
configure_file(duktapeConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/duktapeConfig.cmake" @ONLY)
|
|
|
|
|
|
|
|
install(FILES
|
|
|
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/duktapeConfig.cmake"
|
|
|
|
"${PROJECT_BINARY_DIR}/duktapeConfigVersion.cmake"
|
|
|
|
DESTINATION "share/duktape"
|
|
|
|
)
|