diff --git a/cachelib/CMakeLists.txt b/cachelib/CMakeLists.txt index 9442838..2a22ba8 100644 --- a/cachelib/CMakeLists.txt +++ b/cachelib/CMakeLists.txt @@ -43,6 +43,8 @@ set(PACKAGE_BUGREPORT "https://github.com/facebook/TBD") set(CMAKE_POSITION_INDEPENDENT_CODE ON) option(BUILD_TESTS "If enabled, compile the tests." ON) +option(BUILD_CACHELIB_INTERFACE + "Build the coroutine CacheComponent interface and cachebench." ON) set(BIN_INSTALL_DIR bin CACHE STRING @@ -316,11 +318,15 @@ add_subdirectory (common) add_subdirectory (shm) add_subdirectory (navy) add_subdirectory (allocator) -add_subdirectory (interface) add_subdirectory (datatype) add_subdirectory (compact_cache) add_subdirectory (benchmarks) -add_subdirectory (cachebench) +if (BUILD_CACHELIB_INTERFACE) + add_subdirectory (interface) + add_subdirectory (cachebench) +else () + message(STATUS "Skipping cachelib_interface and cachebench") +endif () # Install the source header files install( @@ -379,13 +385,18 @@ install( ) add_library(cachelib INTERFACE) -target_link_libraries(cachelib INTERFACE +set(CACHELIB_LINK_LIBRARIES cachelib_common cachelib_shm cachelib_navy cachelib_allocator - cachelib_interface ) +if (BUILD_CACHELIB_INTERFACE) + list(APPEND CACHELIB_LINK_LIBRARIES cachelib_interface) +endif () +target_link_libraries(cachelib INTERFACE + ${CACHELIB_LINK_LIBRARIES} + ) target_include_directories( cachelib INTERFACE @@ -405,15 +416,20 @@ install(EXPORT cachelib-exports DESTINATION ${CMAKE_INSTALL_DIR}) if (BUILD_SHARED_LIBS) - set_target_properties( + set(CACHELIB_VERSIONED_TARGETS cachelib_allocator - cachelib_cachebench cachelib_common cachelib_datatype - cachelib_interface cachelib_navy cachelib_shm - PROPERTIES + ) + if (BUILD_CACHELIB_INTERFACE) + list(APPEND CACHELIB_VERSIONED_TARGETS + cachelib_cachebench + cachelib_interface) + endif () + set_target_properties( + ${CACHELIB_VERSIONED_TARGETS} PROPERTIES SOVERSION ${CACHELIB_MAJOR_VERSION} VERSION ${PACKAGE_VERSION} )