4
0
mirror of https://github.com/QuasarApp/LIEF.git synced 2025-05-11 03:09:32 +00:00

Add LIEF_SHARED_LIB option (default ON)

If LIEF_SHARED_LIB=off and LIEF_EXAMPLES=off and LIEF_PYTHON_API=off it works around bug  (Error compiling LIEF with VS2015 (fatal error C1001)) when calling the INSTALL build target
This commit is contained in:
Aure 2018-03-29 09:22:05 -03:00 committed by Romain Thomas
parent 8660060064
commit 04be950eab
2 changed files with 14 additions and 7 deletions

@ -127,7 +127,11 @@ source_group("Source Files" FILES ${LIBLIEF_SOURCE_FILES})
source_group("Header Files\\visitors" FILES ${LIEF_VISITOR_INCLUDE_FILES})
add_library(LIB_LIEF_STATIC STATIC ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES}) # Static one
add_library(LIB_LIEF_SHARED SHARED ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES}) # Shared one
if(LIEF_SHARED_LIB)
add_library(LIB_LIEF_SHARED SHARED ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES}) # Shared one
else()
add_library(LIB_LIEF_SHARED SHARED EXCLUDE_FROM_ALL ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES}) # Shared one
endif()
target_compile_definitions(LIB_LIEF_STATIC PRIVATE -DLIEF_STATIC)
target_compile_definitions(LIB_LIEF_SHARED PRIVATE -DLIEF_EXPORTS)
@ -409,12 +413,14 @@ install(TARGETS LIB_LIEF_STATIC
DESTINATION lib
COMPONENT libraries)
install(TARGETS LIB_LIEF_SHARED
ARCHIVE
DESTINATION lib
LIBRARY
DESTINATION lib
COMPONENT libraries)
if(LIEF_SHARED_LIB)
install(TARGETS LIB_LIEF_SHARED
ARCHIVE
DESTINATION lib
LIBRARY
DESTINATION lib
COMPONENT libraries)
endif()
install(
DIRECTORY ${LIEF_PUBLIC_INCLUDE_DIR}

@ -15,6 +15,7 @@ option(LIEF_USE_CCACHE "Use ccache to speed up compilation" ON)
option(LIEF_EXTRA_WARNINGS "Enable extra warning from the compiler" OFF)
option(LIEF_LOGGING "Enable logging" ON)
option(LIEF_ENABLE_JSON "Enable JSON-related APIs" ON)
option(LIEF_SHARED_LIB "Enable shared lib" ON)
option(LIEF_ELF "Build LIEF with ELF module" ON)
option(LIEF_PE "Build LIEF with PE module" ON)