Skip to content

Commit

Permalink
deps/yara: install libyara archive
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterMatula committed Jul 30, 2020
1 parent 81b0fd2 commit b522bcb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion deps/yara/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ else()
set(_YARA_URL "${YARA_URL}")
endif()

set(YARA_INSTALL_DIR ${CMAKE_BINARY_DIR}/deps/install/yara)
set(YARA_LIB_NAME ${YARA_LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(YARA_LIB_NAMEP libretdec-yara${CMAKE_STATIC_LIBRARY_SUFFIX})
set(YARA_LIB ${YARA_LIBRARY_DIR}/${YARA_LIB_NAME})
set(YARA_LIB_B ${YARA_LIBRARY_DIR}/${YARA_LIB_NAME})
set(YARA_LIB ${YARA_INSTALL_DIR}/lib/${YARA_LIB_NAME})

ExternalProject_Add(yara
SOURCE_DIR ${YARA_SOURCE_DIR}
Expand Down Expand Up @@ -129,6 +131,17 @@ else()
)
endif()

# Install the library file manually.
# We need it to get rif of MSVC's Release/Debug, because gen exprs cannot be
# used in BUILD_BYPRODUCTS.
# We could install YARA using YARA_INSTALL_DIR, but it would not work on MSVC.
ExternalProject_Add_Step(yara move-install
WORKING_DIRECTORY ${YARA_DIR}
DEPENDEES install
COMMAND ${CMAKE_COMMAND} -E make_directory ${YARA_INSTALL_DIR}/lib
COMMAND ${CMAKE_COMMAND} -E copy ${YARA_LIB_B} ${YARA_LIB}
)

# Create target.
add_library(libyara INTERFACE)
add_library(retdec::deps::libyara ALIAS libyara)
Expand Down

0 comments on commit b522bcb

Please sign in to comment.