deps: fix installation of std and authenticode libs

This commit is contained in:
Peter Matula 2022-12-08 09:28:51 +01:00
parent 004a246341
commit e571dc8e80
3 changed files with 77 additions and 60 deletions

View File

@ -1,17 +1,12 @@
cmake_minimum_required(VERSION 3.13)
project(authenticode_parser VERSION 1.0.0 LANGUAGES C)
find_package(OpenSSL 1.1.1 REQUIRED)
include(GNUInstallDirs)
add_library(authenticode STATIC
src/authenticode.c
src/helper.c
src/structs.c
src/countersignature.c
src/certificate.c
src/authenticode.c
src/helper.c
src/structs.c
src/countersignature.c
src/certificate.c
)
add_library(retdec::deps::authenticode ALIAS authenticode)
@ -22,45 +17,55 @@ if(IS_BIG_ENDIAN)
target_compile_definitions(-DWORDS_BIGENDIAN)
endif()
target_compile_options(authenticode PRIVATE -Wall)
target_compile_features(authenticode PRIVATE c_std_11)
# Disable all warnings from this 3rd party project.
if(MSVC)
target_compile_options(authenticode PRIVATE "/w")
else()
target_compile_options(authenticode PRIVATE "-w")
endif()
target_include_directories(authenticode
PUBLIC
$<BUILD_INTERFACE:${RETDEC_DEPS_DIR}/authenticode-parser/include>
$<INSTALL_INTERFACE:${RETDEC_INSTALL_DEPS_INCLUDE_DIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
PUBLIC
$<BUILD_INTERFACE:${RETDEC_DEPS_DIR}/authenticode-parser/include>
$<INSTALL_INTERFACE:${RETDEC_INSTALL_DEPS_INCLUDE_DIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_link_libraries(authenticode
PRIVATE
OpenSSL::Crypto
PRIVATE
OpenSSL::Crypto
)
set_target_properties(authenticode
PROPERTIES
OUTPUT_NAME "retdec-authenticode"
)
# Install includes.
install(
DIRECTORY ${RETDEC_DEPS_DIR}/authenticode-parser/include/
DESTINATION ${RETDEC_INSTALL_DEPS_INCLUDE_DIR}
DIRECTORY ${RETDEC_DEPS_DIR}/authenticode-parser/include/
DESTINATION ${RETDEC_INSTALL_DEPS_INCLUDE_DIR}
)
# Install libs.
install(TARGETS authenticode
EXPORT authenticode-targets
ARCHIVE DESTINATION ${RETDEC_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${RETDEC_INSTALL_LIB_DIR}
EXPORT authenticode-targets
ARCHIVE DESTINATION ${RETDEC_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${RETDEC_INSTALL_LIB_DIR}
)
# Export targets.
install(EXPORT authenticode-targets
FILE "retdec-authenticode-targets.cmake"
NAMESPACE retdec::deps::
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
FILE "retdec-authenticode-targets.cmake"
NAMESPACE retdec::deps::
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
)
configure_file(
"retdec-authenticode-config.cmake"
"${CMAKE_CURRENT_LIST_DIR}/retdec-authenticode-config.cmake"
@ONLY
)
# Install CMake files.
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/retdec-authenticode-config.cmake"
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
)
FILES
"${CMAKE_CURRENT_LIST_DIR}/retdec-authenticode-config.cmake"
DESTINATION
"${RETDEC_INSTALL_CMAKE_DIR}"
)

View File

@ -1,44 +1,54 @@
cmake_minimum_required(VERSION 3.13)
project(stb VERSION 1.0.0 LANGUAGES C)
add_library(stb STATIC
stb_image.c
stb_image.c
)
add_library(retdec::deps::stb ALIAS stb)
target_include_directories(stb
PUBLIC
$<BUILD_INTERFACE:${RETDEC_DEPS_DIR}/stb/include>
$<INSTALL_INTERFACE:${RETDEC_INSTALL_DEPS_INCLUDE_DIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
SYSTEM INTERFACE
$<BUILD_INTERFACE:${RETDEC_DEPS_DIR}/stb/include>
$<INSTALL_INTERFACE:${RETDEC_INSTALL_DEPS_INCLUDE_DIR}>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/stb>
)
set_target_properties(stb
PROPERTIES
OUTPUT_NAME "retdec-stb"
)
# Disable all warnings from this 3rd party project.
if(MSVC)
target_compile_options(stb PRIVATE "/w")
else()
target_compile_options(stb PRIVATE "-w")
endif()
# Install includes.
install(
DIRECTORY ${RETDEC_DEPS_DIR}/stb/include/
DESTINATION ${RETDEC_INSTALL_DEPS_INCLUDE_DIR}
DIRECTORY ${RETDEC_DEPS_DIR}/stb/include/
DESTINATION ${RETDEC_INSTALL_DEPS_INCLUDE_DIR}
)
# Install libs.
install(TARGETS stb
EXPORT stb-targets
ARCHIVE DESTINATION ${RETDEC_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${RETDEC_INSTALL_LIB_DIR}
EXPORT stb-targets
ARCHIVE DESTINATION ${RETDEC_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${RETDEC_INSTALL_LIB_DIR}
)
# Export targets.
install(EXPORT stb-targets
FILE "retdec-stb-targets.cmake"
NAMESPACE retdec::deps::
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
FILE "retdec-stb-targets.cmake"
NAMESPACE retdec::deps::
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
)
configure_file(
"retdec-stb-config.cmake"
"${CMAKE_CURRENT_LIST_DIR}/retdec-stb-config.cmake"
@ONLY
)
# Install CMake files.
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/retdec-stb-config.cmake"
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
)
FILES
"${CMAKE_CURRENT_LIST_DIR}/retdec-stb-config.cmake"
DESTINATION
"${RETDEC_INSTALL_CMAKE_DIR}"
)

View File

@ -15,6 +15,8 @@ if(NOT TARGET retdec::fileformat)
elfio
llvm
tlsh
stb
authenticode
)
include(${CMAKE_CURRENT_LIST_DIR}/retdec-fileformat-targets.cmake)