mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Fix BUILD_SHARED_LIBS issue (#1496)
This commit is contained in:
parent
294db69227
commit
c720204199
3 changed files with 12 additions and 17 deletions
|
@ -1,7 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Use \"OFF\" for a static build." ON)
|
||||
|
||||
if (NOT OPENSSL_FOUND)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
endif()
|
||||
|
@ -92,10 +90,10 @@ set(TONLIB_JSON_HEADERS tonlib/tonlib_client_json.h)
|
|||
set(TONLIB_JSON_SOURCE tonlib/tonlib_client_json.cpp)
|
||||
|
||||
include(GenerateExportHeader)
|
||||
if (NOT USE_EMSCRIPTEN AND BUILD_SHARED_LIBS)
|
||||
add_library(tonlibjson SHARED ${TONLIB_JSON_SOURCE} ${TONLIB_JSON_HEADERS})
|
||||
if (USE_EMSCRIPTEN)
|
||||
add_library(tonlibjson STATIC ${TONLIB_JSON_SOURCE})
|
||||
else()
|
||||
add_library(tonlibjson STATIC ${TONLIB_JSON_SOURCE} ${TONLIB_JSON_HEADERS})
|
||||
add_library(tonlibjson SHARED ${TONLIB_JSON_SOURCE})
|
||||
endif()
|
||||
|
||||
if (PORTABLE AND NOT APPLE)
|
||||
|
@ -105,7 +103,7 @@ else()
|
|||
endif()
|
||||
|
||||
generate_export_header(tonlibjson EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/tonlib/tonlibjson_export.h)
|
||||
if (!BUILD_SHARED_LIBS)
|
||||
if (USE_EMSCRIPTEN)
|
||||
target_compile_definitions(tonlibjson PUBLIC TONLIBJSON_STATIC_DEFINE)
|
||||
endif()
|
||||
target_include_directories(tonlibjson PUBLIC
|
||||
|
@ -159,7 +157,7 @@ endif()
|
|||
|
||||
install(FILES ${TONLIB_JSON_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/tonlib/tonlibjson_export.h DESTINATION include/tonlib/)
|
||||
|
||||
if (NOT USE_EMSCRIPTEN AND BUILD_SHARED_LIBS)
|
||||
if (NOT USE_EMSCRIPTEN)
|
||||
install(EXPORT Tonlib
|
||||
FILE TonlibTargets.cmake
|
||||
NAMESPACE Tonlib::
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue