mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Add duktapeConfig.cmake to ease configuration.
Used for reference: https://github.com/microsoft/vcpkg/blob/master/ports/duktape/duktapeConfig.cmake.in
This commit is contained in:
parent
06bbf5ddda
commit
6edf9b03e0
3 changed files with 44 additions and 9 deletions
|
@ -9,8 +9,10 @@ project(openrct2 CXX)
|
|||
include(cmake/platform.cmake)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
# vcpkg includes its own copy of duktapeConfig.cmake; only include ours as needed.
|
||||
if (NOT MSVC)
|
||||
include(FindPkgConfig)
|
||||
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
|
||||
endif ()
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(GNUInstallDirs)
|
||||
|
|
37
cmake/duktapeConfig.cmake
Normal file
37
cmake/duktapeConfig.cmake
Normal file
|
@ -0,0 +1,37 @@
|
|||
# This file was obtained from:
|
||||
# https://github.com/microsoft/vcpkg/blob/master/ports/duktape/duktapeConfig.cmake.in
|
||||
# It is used under the terms of the MIT License.
|
||||
|
||||
# - Try to find duktape
|
||||
# Once done this will define
|
||||
#
|
||||
# DUKTAPE_FOUND - system has Duktape
|
||||
# DUKTAPE_INCLUDE_DIRS - the Duktape include directory
|
||||
# DUKTAPE_LIBRARIES - Link these to use DUKTAPE
|
||||
# DUKTAPE_DEFINITIONS - Compiler switches required for using Duktape
|
||||
#
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_DUK QUIET duktape libduktape)
|
||||
|
||||
find_path(DUKTAPE_INCLUDE_DIR duktape.h
|
||||
HINTS ${PC_DUK_INCLUDEDIR} ${PC_DUK_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES duktape)
|
||||
|
||||
find_library(DUKTAPE_LIBRARY
|
||||
NAMES duktape libduktape
|
||||
HINTS ${PC_DUK_LIBDIR} ${PC_DUK_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(duktape
|
||||
REQUIRED_VARS DUKTAPE_LIBRARY DUKTAPE_INCLUDE_DIR)
|
||||
|
||||
if (DUKTAPE_FOUND)
|
||||
set (DUKTAPE_LIBRARIES ${DUKTAPE_LIBRARY})
|
||||
set (DUKTAPE_INCLUDE_DIRS ${DUKTAPE_INCLUDE_DIR} )
|
||||
endif ()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
DUKTAPE_INCLUDE_DIR
|
||||
DUKTAPE_LIBRARY
|
||||
)
|
|
@ -101,16 +101,12 @@ if (NOT DISABLE_GOOGLE_BENCHMARK)
|
|||
endif ()
|
||||
|
||||
if (ENABLE_SCRIPTING)
|
||||
if (MSVC)
|
||||
find_package(duktape REQUIRED)
|
||||
find_package(duktape CONFIG REQUIRED)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${DUKTAPE_INCLUDE_DIRS})
|
||||
if (STATIC)
|
||||
target_link_libraries(${PROJECT_NAME} ${DUKTAPE_STATIC_LIBRARY})
|
||||
else ()
|
||||
PKG_CHECK_MODULES(DUKTAPE REQUIRED duktape)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${DUKTAPE_INCLUDE_DIRS})
|
||||
if (STATIC)
|
||||
target_link_libraries(${PROJECT_NAME} ${DUKTAPE_STATIC_LIBRARIES})
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME} ${DUKTAPE_LIBRARIES})
|
||||
endif ()
|
||||
target_link_libraries(${PROJECT_NAME} ${DUKTAPE_LIBRARY})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
Loading…
Reference in a new issue