diff --git a/CMakeLists.txt b/CMakeLists.txt index 4087211..1ab3b42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ INCLUDE(CTest) INCLUDE(CheckFunctionExists) INCLUDE(CheckCSourceCompiles) + SET(CMAKE_REQUIRED_FLAGS "-lm -lstasis -lpthread") MACRO(CREATE_CHECK NAME) @@ -37,7 +38,7 @@ ENDMACRO(CREATE_EXECUTABLE) MACRO(CREATE_CLIENT_EXECUTABLE NAME) ADD_EXECUTABLE(${NAME} ${NAME}.cpp) TARGET_LINK_LIBRARIES(${NAME} ${CLIENT_LIBRARIES}) -ENDMACRO(CREATE_EXECUTABLE) +ENDMACRO(CREATE_CLIENT_EXECUTABLE NAME) # Output the config.h file @@ -49,6 +50,11 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../stasis/ # set linker path for this and all subdirs LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../stasis/build/src/stasis ${CMAKE_CURRENT_BINARY_DIR}) +FIND_LIBRARY(HAVE_STASIS NAMES stasis PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../stasis/build/src/stasis) +if(NOT HAVE_STASIS) + message(STATUS "stasis not found; only building client library") +endif(NOT HAVE_STASIS) + SET(CLIENT_LIBRARIES logstore_client) IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) @@ -69,6 +75,8 @@ ENDIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) #CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) -ADD_LIBRARY(logstore logserver.cpp logstore.cpp diskTreeComponent.cpp logiterators.cpp datapage.cpp merger.cpp tuplemerger.cpp) +IF ( HAVE_STASIS ) + ADD_LIBRARY(logstore logserver.cpp logstore.cpp diskTreeComponent.cpp logiterators.cpp datapage.cpp merger.cpp tuplemerger.cpp) + CREATE_EXECUTABLE(server) +ENDIF ( HAVE_STASIS ) ADD_LIBRARY(logstore_client tcpclient.cpp) -CREATE_EXECUTABLE(server) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 90c10b4..46de3a5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,9 +1,11 @@ -CREATE_CHECK(check_gen) -CREATE_CHECK(check_logtree) -CREATE_CHECK(check_datapage) -CREATE_CHECK(check_logtable) -CREATE_CHECK(check_merge) -CREATE_CHECK(check_mergelarge) -CREATE_CHECK(check_mergetuple) -CREATE_CHECK(check_rbtree) +IF( HAVE_STASIS ) + CREATE_CHECK(check_gen) + CREATE_CHECK(check_logtree) + CREATE_CHECK(check_datapage) + CREATE_CHECK(check_logtable) + CREATE_CHECK(check_merge) + CREATE_CHECK(check_mergelarge) + CREATE_CHECK(check_mergetuple) + CREATE_CHECK(check_rbtree) +ENDIF( HAVE_STASIS ) CREATE_CLIENT_EXECUTABLE(check_tcpclient)