2020-11-12 01:50:36 +08:00
get_filename_component ( _IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH )
get_filename_component ( _IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH )
get_filename_component ( _IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH )
if ( _IMPORT_PREFIX STREQUAL "/" )
set ( _IMPORT_PREFIX "" )
endif ( )
include ( SelectLibraryConfigurations )
find_path ( V8_INCLUDE_DIR NAMES v8.h PATH_SUFFIXES include )
if ( EXISTS ${ _IMPORT_PREFIX } /bin/snapshot_blob.bin )
set ( V8_SNAPSHOT_BLOB_RELEASE ${ _IMPORT_PREFIX } /bin/snapshot_blob.bin CACHE FILEPATH "Release version of V8 snapshot blob location" )
endif ( )
if ( EXISTS ${ _IMPORT_PREFIX } /debug/bin/snapshot_blob.bin )
set ( V8_SNAPSHOT_BLOB_DEBUG ${ _IMPORT_PREFIX } /debug/bin/snapshot_blob.bin CACHE FILEPATH "Debug version of V8 snapshot blob location" )
endif ( )
2021-10-13 08:11:26 +08:00
set ( V8_SNAPSHOT_BLOB "$<IF:$<CONFIG:Debug>,${V8_SNAPSHOT_BLOB_DEBUG},${V8_SNAPSHOT_BLOB_RELEASE}>" )
2020-11-12 01:50:36 +08:00
if ( EXISTS "${_IMPORT_PREFIX}/lib/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
set ( V8_LIBRARY_RELEASE "${_IMPORT_PREFIX}/lib/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Release version of the V8 library location" )
endif ( )
if ( EXISTS "${_IMPORT_PREFIX}/debug/lib/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
set ( V8_LIBRARY_DEBUG "${_IMPORT_PREFIX}/debug/lib/v8${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Debug version of the V8 library location" )
endif ( )
select_library_configurations ( V8 )
if ( EXISTS "${_IMPORT_PREFIX}/lib/v8_libbase${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
set ( V8LIBBASE_LIBRARY_RELEASE "${_IMPORT_PREFIX}/lib/v8_libbase${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Release version of the V8 libbase library location" )
endif ( )
if ( EXISTS "${_IMPORT_PREFIX}/debug/lib/v8_libbase${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
set ( V8LIBBASE_LIBRARY_DEBUG "${_IMPORT_PREFIX}/debug/lib/v8_libbase${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Debug version of the V8 libbase library location" )
endif ( )
select_library_configurations ( V8LIBBASE )
if ( EXISTS "${_IMPORT_PREFIX}/lib/v8_libplatform${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
set ( V8LIBPLATFORM_LIBRARY_RELEASE "${_IMPORT_PREFIX}/lib/v8_libplatform${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Release version of the V8 libplatform library location" )
endif ( )
if ( EXISTS "${_IMPORT_PREFIX}/debug/lib/v8_libplatform${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
set ( V8LIBPLATFORM_LIBRARY_DEBUG "${_IMPORT_PREFIX}/debug/lib/v8_libplatform${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE FILEPATH "Delete version of the V8 libplatform library location" )
endif ( )
select_library_configurations ( V8LIBPLATFORM )
mark_as_advanced ( V8_INCLUDE_DIR )
if ( V8_INCLUDE_DIR AND EXISTS "${V8_INCLUDE_DIR}/v8-version.h" )
file ( STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_MAJOR_VERSION REGEX "^#define V8_MAJOR_VERSION [0-9]+.*$" )
string ( REGEX REPLACE "^#define V8_MAJOR_VERSION ([0-9]+).*$" "\\1" V8_MAJOR_VERSION "${V8_MAJOR_VERSION}" )
file ( STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_MINOR_VERSION REGEX "^#define V8_MINOR_VERSION [0-9]+.*$" )
string ( REGEX REPLACE "^#define V8_MINOR_VERSION ([0-9]+).*$" "\\1" V8_MINOR_VERSION "${V8_MINOR_VERSION}" )
file ( STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_BUILD_NUMBER REGEX "^#define V8_BUILD_NUMBER [0-9]+.*$" )
string ( REGEX REPLACE "^#define V8_BUILD_NUMBER ([0-9]+).*$" "\\1" V8_BUILD_NUMBER "${V8_BUILD_NUMBER}" )
file ( STRINGS "${V8_INCLUDE_DIR}/v8-version.h" V8_PATCH_LEVEL REGEX "^#define V8_PATCH_LEVEL [0-9]+.*$" )
string ( REGEX REPLACE "^#define V8_PATCH_LEVEL ([0-9]+).*$" "\\1" V8_PATCH_LEVEL "${V8_PATCH_LEVEL}" )
set ( V8_VERSION_STRING "${V8_MAJOR_VERSION}.${V8_MINOR_VERSION}.${V8_BUILD_NUMBER}.${V8_PATCH_LEVEL}" )
endif ( )
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( V8_COMPILE_DEFINITIONS "V8_COMPRESS_POINTERS;V8_31BIT_SMIS_ON_64BIT_ARCH" )
elseif ( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set ( V8_COMPILE_DEFINITIONS " " )
endif ( )
mark_as_advanced ( V8_COMPILE_DEFINITIONS )
include ( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS ( V8 REQUIRED_VARS V8_LIBRARY V8LIBBASE_LIBRARY V8LIBPLATFORM_LIBRARY V8_INCLUDE_DIR V8_COMPILE_DEFINITIONS
V E R S I O N _ V A R V 8 _ V E R S I O N _ S T R I N G )
set ( V8_LIBRARIES ${ V8_LIBRARY } ${ V8LIBBASE_LIBRARY } ${ V8LIBPLATFORM_LIBRARY } )
mark_as_advanced ( V8_LIBRARIES )
if ( NOT TARGET V8::V8 )
add_library ( V8::V8 SHARED IMPORTED )
set_target_properties ( V8::V8 PROPERTIES
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S " $ { V 8 _ I N C L U D E _ D I R } "
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S " $ { V 8 _ C O M P I L E _ D E F I N I T I O N S } " )
if ( V8_LIBRARY_RELEASE )
set_property ( TARGET V8::V8 APPEND PROPERTY
I M P O R T E D _ C O N F I G U R A T I O N S R E L E A S E )
set_target_properties ( V8::V8 PROPERTIES
I M P O R T E D _ L O C A T I O N _ R E L E A S E " $ { _ I M P O R T _ P R E F I X } / b i n / v 8 $ { C M A K E _ S H A R E D _ L I B R A R Y _ S U F F I X } $ { C M A K E _ S T A T I C _ L I B R A R Y _ S U F F I X } "
I M P O R T E D _ I M P L I B _ R E L E A S E " $ { V 8 _ L I B R A R Y _ R E L E A S E } "
)
set_target_properties ( V8::V8 PROPERTIES
I M P O R T E D _ L I N K _ I N T E R F A C E _ L I B R A R I E S _ R E L E A S E
" $ { V 8 L I B B A S E _ L I B R A R Y _ R E L E A S E } ; $ { V 8 L I B P L A T F O R M _ L I B R A R Y _ R E L E A S E } " )
endif ( )
if ( V8_LIBRARY_DEBUG )
set_property ( TARGET V8::V8 APPEND PROPERTY
I M P O R T E D _ C O N F I G U R A T I O N S D E B U G )
set_target_properties ( V8::V8 PROPERTIES
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { _ I M P O R T _ P R E F I X } / d e b u g / b i n / v 8 $ { C M A K E _ S H A R E D _ L I B R A R Y _ S U F F I X } $ { C M A K E _ S T A T I C _ L I B R A R Y _ S U F F I X } "
I M P O R T E D _ I M P L I B _ D E B U G " $ { V 8 _ L I B R A R Y _ D E B U G } " )
set_target_properties ( V8::V8 PROPERTIES
I M P O R T E D _ L I N K _ I N T E R F A C E _ L I B R A R I E S _ D E B U G
" $ { V 8 L I B B A S E _ L I B R A R Y _ D E B U G } ; $ { V 8 L I B P L A T F O R M _ L I B R A R Y _ D E B U G } " )
endif ( )
if ( NOT V8_LIBRARY_RELEASE AND NOT V8_LIBRARY_DEBUG )
set_property ( TARGET V8::V8 APPEND PROPERTY
I M P O R T E D _ I M P L I B " $ { V 8 _ L I B R A R Y } " )
set_target_properties ( V8::V8 PROPERTIES
I M P O R T E D _ L I N K _ I N T E R F A C E _ L I B R A R I E S
" $ { V 8 L I B B A S E _ L I B R A R Y } ; $ { V 8 L I B P L A T F O R M _ L I B R A R Y } " )
endif ( )
endif ( )