CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(libfluent)

SET(CMAKE_CXX_FLAGS "-Wall  -std=c++0x")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
SET(CMAKE_CXX_FLAGS_DEBUG   "-O0 -g")
SET(CMAKE_SHARED_LINKER_FLAGS "-dynamiclib")

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

# cmake_policy(SET CMP0015 NEW)

INCLUDE_DIRECTORIES(${INC_DIR} ./src)
LINK_DIRECTORIES(${LIB_DIR})

# Build library

FILE(GLOB BASESRCS "src/*.cc" "src/*.hpp")
FILE(GLOB TESTSRCS "test/*.cc")
FILE(GLOB HEADERS "src/fluent/*.hpp")

ADD_LIBRARY(fluent SHARED ${BASESRCS})
TARGET_LINK_LIBRARIES(fluent msgpack pthread)

ADD_EXECUTABLE(fluent-test ${TESTSRCS})
TARGET_LINK_LIBRARIES(fluent-test fluent)

INSTALL(TARGETS fluent LIBRARY DESTINATION lib)
INSTALL(FILES src/fluent.hpp DESTINATION include/)
INSTALL(FILES ${HEADERS} DESTINATION include/fluent)

ADD_EXECUTABLE(fluent-bench tools/fluent-bench.cc)
TARGET_LINK_LIBRARIES(fluent-bench fluent)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(libfluent)

SET(CMAKE_CXX_FLAGS "-Wall  -std=c++0x")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
SET(CMAKE_CXX_FLAGS_DEBUG   "-O0 -g")
SET(CMAKE_SHARED_LINKER_FLAGS "-dynamiclib")

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

# cmake_policy(SET CMP0015 NEW)

INCLUDE_DIRECTORIES(${INC_DIR} ./src)
LINK_DIRECTORIES(${LIB_DIR})

# Build library

FILE(GLOB BASESRCS "src/*.cc" "src/*.hpp")
FILE(GLOB TESTSRCS "test/*.cc")
FILE(GLOB HEADERS "src/fluent/*.hpp")

ADD_LIBRARY(fluent SHARED ${BASESRCS})
TARGET_LINK_LIBRARIES(fluent msgpack pthread)

ADD_EXECUTABLE(fluent-test ${TESTSRCS})
TARGET_LINK_LIBRARIES(fluent-test fluent)

ADD_EXECUTABLE(fluent-bench tools/fluent-bench.cc)
TARGET_LINK_LIBRARIES(fluent-bench fluent)

INSTALL(TARGETS fluent
  EXPORT fluentConfig
  INCLUDES DESTINATION include
  LIBRARY DESTINATION lib
)
INSTALL(FILES src/fluent.hpp DESTINATION include/)
INSTALL(FILES ${HEADERS} DESTINATION include/fluent)
INSTALL(EXPORT fluentConfig DESTINATION cmake)

Add export configure of cmake
Add export configure of cmake
