aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/CMakeLists.txt')
-rw-r--r--libtransport/src/CMakeLists.txt59
1 files changed, 23 insertions, 36 deletions
diff --git a/libtransport/src/CMakeLists.txt b/libtransport/src/CMakeLists.txt
index 079427fea..5e0cd38e7 100644
--- a/libtransport/src/CMakeLists.txt
+++ b/libtransport/src/CMakeLists.txt
@@ -11,8 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-
include(GNUInstallDirs)
set(ASIO_STANDALONE 1)
@@ -31,17 +29,16 @@ configure_file("config.h.in" "hicn/transport/config.h" @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/hicn/transport/config.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hicn/transport
- COMPONENT lib${LIBTRANSPORT}-dev
+ COMPONENT ${LIBTRANSPORT_COMPONENT}-dev
)
install(
FILES "transport.config"
DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/hicn
- COMPONENT lib${LIBTRANSPORT}
+ COMPONENT ${LIBTRANSPORT_COMPONENT}
)
list(APPEND COMPILER_DEFINITIONS
- "-DTRANSPORT_LOG_DEF_LEVEL=TRANSPORT_LOG_${TRANSPORT_LOG_LEVEL}"
"-DASIO_STANDALONE"
)
@@ -67,42 +64,32 @@ endif ()
if (${CMAKE_SYSTEM_NAME} MATCHES "Android")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -isystem -lm")
- add_subdirectory(io_modules)
endif()
-if (DISABLE_SHARED_LIBRARIES)
- build_library(${LIBTRANSPORT}
- STATIC
- SOURCES ${SOURCE_FILES} ${HEADER_FILES}
- INSTALL_HEADERS ${LIBHICNTRANSPORT_TO_INSTALL_HEADER_FILES}
- LINK_LIBRARIES ${LIBRARIES}
- DEPENDS ${DEPENDENCIES}
- COMPONENT lib${LIBTRANSPORT}
- INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} ${LIBTRANSPORT_INTERNAL_INCLUDE_DIRS}
- HEADER_ROOT_DIR hicn/transport
- DEFINITIONS ${COMPILER_DEFINITIONS}
- VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}
- )
-else ()
- build_library(${LIBTRANSPORT}
- STATIC SHARED
- SOURCES ${SOURCE_FILES} ${HEADER_FILES}
- INSTALL_HEADERS ${LIBHICNTRANSPORT_TO_INSTALL_HEADER_FILES}
- LINK_LIBRARIES ${LIBRARIES}
- DEPENDS ${DEPENDENCIES}
- COMPONENT lib${LIBTRANSPORT}
- INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} ${LIBTRANSPORT_INTERNAL_INCLUDE_DIRS}
- HEADER_ROOT_DIR hicn/transport
- DEFINITIONS ${COMPILER_DEFINITIONS}
- VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}
- )
-endif ()
+set (BUILD_TYPES "STATIC")
-# io modules
-if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")
- add_subdirectory(io_modules)
+if (NOT DISABLE_SHARED_LIBRARIES)
+ list(APPEND BUILD_TYPES
+ "SHARED"
+ )
endif()
+add_subdirectory(io_modules)
+
+build_library(${LIBTRANSPORT}
+ ${BUILD_TYPES}
+ SOURCES ${SOURCE_FILES} ${HEADER_FILES}
+ INSTALL_HEADERS ${LIBHICNTRANSPORT_TO_INSTALL_HEADER_FILES}
+ LINK_LIBRARIES ${LIBRARIES}
+ OBJECT_LIBRARIES ${THIRD_PARTY_OBJECT_LIBRARIES}
+ DEPENDS ${DEPENDENCIES}
+ COMPONENT ${LIBTRANSPORT_COMPONENT}
+ INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} ${LIBTRANSPORT_INTERNAL_INCLUDE_DIRS}
+ HEADER_ROOT_DIR hicn/transport
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}
+)
+
if (${BUILD_TESTS})
add_subdirectory(test)
endif()