LIEF/cmake/LIEFApi.cmake
Adrien Guinet 4b03ac45e0 Remove LIEF_SHARED_LIB from cmake
Moreover, add macros to force the CRT usage when using MSVC.
This is based on the LLVM one.
2018-08-29 08:50:56 +02:00

67 lines
1.6 KiB
CMake
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

if(__add_lief_api)
return()
endif()
set(__add_lief_api ON)
# Python
# ------
if (LIEF_PYTHON_API)
if(WIN32)
set(PYTHON_BUILD_LIEF_DIRECTORY "${CMAKE_BINARY_DIR}/api/python/Release")
else()
set(PYTHON_BUILD_LIEF_DIRECTORY "${CMAKE_BINARY_DIR}/api/python")
endif()
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/api/python")
endif()
# C API
# -----
if(LIEF_C_API)
# ELF
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/enums.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/ELF/enums.h"
@ONLY
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/structures.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/ELF/structures.h"
@ONLY
)
# PE
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/enums.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/PE/enums.h"
@ONLY
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/structures.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/PE/structures.h"
@ONLY
)
# MachO
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/enums.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/MachO/enums.h"
@ONLY
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/structures.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/MachO/structures.h"
@ONLY
)
target_include_directories(LIB_LIEF
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/api/c/include"
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/api/c/include")
include("${CMAKE_CURRENT_SOURCE_DIR}/api/c/CMakeLists.txt")
endif()