include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/MakeIncludesLink.cmake)
MakeIncludesLink()

add_definitions(-DBOOST_PP_VARIADICS)

include_directories(
    ${Boost_INCLUDE_DIRS}
    ${ETHCRYPTO_INCLUDE_DIRS}
    ${CMAKE_CURRENT_SOURCE_DIR}/src
)

if(NOT MSVC)
    set(CMAKE_CXX_FLAGS "-fPIC")
endif()

file(GLOB_RECURSE LIBRARY_SOURCES "src/*.cpp")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}")

add_library(abi STATIC ${LIBRARY_SOURCES})

if(NOT SKIP_LIBRARY_INSTALL)
    install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/abi DESTINATION include OPTIONAL)
    install (TARGETS abi ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin OPTIONAL)
endif()


set(ABI_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include CACHE STRING "" FORCE) 
set(ABI_INCLUDE_DIRS ${ABI_INCLUDE_DIR} CACHE STRING "" FORCE)
set(ABI_LIBRARY abi CACHE STRING "" FORCE)
set(ABI_LIBRARIES ${ABI_LIBRARY} CACHE STRING "" FORCE)
