Files
aman-es/cmake/3rdPartyTargets.cmake
2021-08-16 16:46:50 +02:00

60 líneas
2.1 KiB
CMake

# Author:
# Sven Czarnian <devel@svcz.de>
# License:
# GPLv3
# Brief:
# Creates the 3rd-party import targets
# include the external project library
INCLUDE(ExternalProject)
# define the import target of libsodium
ADD_LIBRARY(libsodium STATIC IMPORTED)
IF (MSVC)
SET_TARGET_PROPERTIES(libsodium PROPERTIES
IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/external/lib/libsodiumd.lib"
IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/external/lib/libsodium.lib"
)
TARGET_LINK_LIBRARIES(libsodium INTERFACE Ws2_32 Iphlpapi)
TARGET_INCLUDE_DIRECTORIES(libsodium INTERFACE "${CMAKE_SOURCE_DIR}/external/include")
ELSE ()
MESSAGE(FATAL_ERROR "Unsupported compiler")
ENDIF ()
# define the import target of libzmq
ADD_LIBRARY(libzmq STATIC IMPORTED)
ADD_DEPENDENCIES(libzmq libsodium)
IF (MSVC)
SET_TARGET_PROPERTIES(libzmq PROPERTIES
IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/external/lib/libzmqd.lib"
IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/external/lib/libzmq.lib"
)
TARGET_INCLUDE_DIRECTORIES(libzmq INTERFACE "${CMAKE_SOURCE_DIR}/external/include")
TARGET_LINK_LIBRARIES(libzmq INTERFACE libsodium)
TARGET_COMPILE_OPTIONS(libzmq INTERFACE /DZMQ_STATIC)
ELSE ()
MESSAGE(FATAL_ERROR "Unsupported compiler")
ENDIF ()
# define the import target of cppzmq
ADD_LIBRARY(cppzmq INTERFACE)
TARGET_INCLUDE_DIRECTORIES(cppzmq INTERFACE "${CMAKE_SOURCE_DIR}/external/include")
TARGET_LINK_LIBRARIES(cppzmq INTERFACE libzmq)
ADD_DEPENDENCIES(cppzmq libzmq)
# define the import target of GSL
ADD_LIBRARY(GSL INTERFACE)
TARGET_INCLUDE_DIRECTORIES(GSL INTERFACE "${CMAKE_SOURCE_DIR}/external/include")
# define the import target of protobuf
ADD_LIBRARY(protobuf STATIC IMPORTED)
IF (MSVC)
SET_TARGET_PROPERTIES(protobuf PROPERTIES
IMPORTED_LOCATION_DEBUG "${CMAKE_INSTALL_PREFIX}/lib/libprotobufd.lib"
IMPORTED_LOCATION_RELEASE "${CMAKE_INSTALL_PREFIX}/lib/libprotobuf.lib"
)
TARGET_INCLUDE_DIRECTORIES(protobuf INTERFACE "${CMAKE_INSTALL_PREFIX}/include")
ELSE ()
MESSAGE(FATAL_ERROR "Unsupported compiler")
ENDIF ()