Fail build if libarchive build failed and update linking
This commit is contained in:
13
3rdParty/CMakeLists.txt
vendored
13
3rdParty/CMakeLists.txt
vendored
@@ -30,7 +30,12 @@ if (NOT LibArchive_FOUND)
|
|||||||
)
|
)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/deps
|
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/deps
|
||||||
|
RESULT_VARIABLE build_result
|
||||||
)
|
)
|
||||||
|
if (NOT ${build_result} EQUAL "0")
|
||||||
|
message(FATAL_ERROR "Failed to build lib archive!")
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/deps/INSTALL)
|
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/deps/INSTALL)
|
||||||
else ()
|
else ()
|
||||||
message("Using system LibArchive")
|
message("Using system LibArchive")
|
||||||
@@ -46,5 +51,11 @@ function(LinkLibArchive TARGET)
|
|||||||
find_package(BZip2 QUIET)
|
find_package(BZip2 QUIET)
|
||||||
find_package(LibLZMA QUIET)
|
find_package(LibLZMA QUIET)
|
||||||
target_include_directories(${TARGET} PRIVATE ${LibArchive_INCLUDE_DIR})
|
target_include_directories(${TARGET} PRIVATE ${LibArchive_INCLUDE_DIR})
|
||||||
target_link_libraries(${TARGET} PRIVATE ${LibArchive_LIBRARIES} ${ZLIB_LIBRARIES} ${zstd_LIBRARIES} ${LZ4_LIBRARIES} ${LIBLZMA_LIBRARIES} ${BZIP2_LIBRARIES})
|
target_link_libraries(${TARGET} PRIVATE ${LibArchive_LIBRARIES} ${ZLIB_LIBRARIES} ${zstd_LIBRARIES} ${LZ4_LIBRARIES})
|
||||||
|
if (BZIP2_LIBRARIES)
|
||||||
|
target_link_libraries(${TARGET} PRIVATE ${BZIP2_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
if (LIBLZMA_LIBRARIES)
|
||||||
|
target_link_libraries(${TARGET} PRIVATE ${LIBLZMA_LIBRARIES})
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
Reference in New Issue
Block a user