mirror of
https://github.com/vtnerd/monero-lws.git
synced 2024-11-16 17:27:39 +00:00
Fix cmake issues for optional libraries
This commit is contained in:
parent
21a9c9a8da
commit
c0eb6eb201
1 changed files with 15 additions and 8 deletions
|
@ -51,9 +51,10 @@ set(MONERO_LIBRARIES
|
|||
easylogging
|
||||
version
|
||||
wallet-crypto
|
||||
unbound
|
||||
)
|
||||
|
||||
set(MONERO_OPTIONAL wallet-crypto)
|
||||
set(MONERO_OPTIONAL unbound wallet-crypto)
|
||||
|
||||
set(MONERO_SEARCH_PATHS
|
||||
"/contrib/epee/src"
|
||||
|
@ -104,6 +105,10 @@ if (NOT (CMAKE_CXX_COMPILER STREQUAL monero_CMAKE_CXX_COMPILER))
|
|||
message(FATAL_ERROR "Compiler for monero build differs from this project")
|
||||
endif()
|
||||
|
||||
if ("${monero_UNBOUND_LIBRARIES}" STREQUAL "UNBOUND_LIBRARIES-NOTFOUND")
|
||||
unset(monero_UNBOUND_LIBRARIES)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Dependencies specific to monero-lws
|
||||
#
|
||||
|
@ -121,15 +126,17 @@ foreach (LIB ${MONERO_LIBRARIES})
|
|||
find_library(LIB_PATH NAMES "${LIB}" PATHS ${MONERO_BUILD_DIR} PATH_SUFFIXES "/src/${LIB}" "external/${LIB}" ${MONERO_SEARCH_PATHS} REQUIRED NO_DEFAULT_PATH)
|
||||
|
||||
list(FIND MONERO_OPTIONAL "${LIB}" LIB_OPTIONAL)
|
||||
if (NOT LIB_PATH AND NOT LIB_OPTIONAL)
|
||||
message(FATAL_ERROR "Unable to find required Monero library ${LIB}")
|
||||
if (NOT LIB_PATH)
|
||||
if (LIB_OPTIONAL EQUAL -1)
|
||||
message(FATAL_ERROR "Unable to find required Monero library ${LIB}")
|
||||
endif()
|
||||
else ()
|
||||
set(LIB_NAME "monero::${LIB}")
|
||||
add_library(${LIB_NAME} STATIC IMPORTED)
|
||||
set_target_properties(${LIB_NAME} PROPERTIES IMPORTED_LOCATION ${LIB_PATH})
|
||||
list(APPEND IMPORTED_MONERO_LIBRARIES "${LIB_NAME}")
|
||||
endif()
|
||||
|
||||
set(LIB_NAME "monero::${LIB}")
|
||||
add_library(${LIB_NAME} STATIC IMPORTED)
|
||||
set_target_properties(${LIB_NAME} PROPERTIES IMPORTED_LOCATION ${LIB_PATH})
|
||||
|
||||
list(APPEND IMPORTED_MONERO_LIBRARIES "${LIB_NAME}")
|
||||
unset(LIB_PATH CACHE)
|
||||
endforeach()
|
||||
|
||||
|
|
Loading…
Reference in a new issue