CMakeLists.txt 1.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
cmake_minimum_required(VERSION 3.0)
project(BEAT_CORE_CXX_INTEGERS_ANALYZER)


set(BEAT_BACKEND_CXX_DIR "/usr/local/beat")


# CMake setup
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if (COMPILER_SUPPORTS_CXX11)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif (COMPILER_SUPPORTS_CXX0X)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
    message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()


# Retrieve the dependencies
find_package(Boost REQUIRED)


# Setup the search paths
include_directories(
    "${BEAT_BACKEND_CXX_DIR}/include"
    "${Boost_INCLUDE_DIRS}"
)

link_directories(
    "${BEAT_BACKEND_CXX_DIR}/bin"
)


# List the source files
set(HEADERS "algorithm.h"
            "beat_setup.h"
            "user_single_integer_1.h"
)

set(SRCS "algorithm.cpp"
         "beat_setup.cpp"
         "user_single_integer_1.cpp"
)

# Create and link the library
add_library(cxx_integers_echo_analyzer SHARED ${SRCS} ${HEADERS})

target_link_libraries(cxx_integers_echo_analyzer beat_backend_cxx)
set_target_properties(cxx_integers_echo_analyzer PROPERTIES
                                                 COMPILE_FLAGS "-fPIC"
                                                 OUTPUT_NAME "1"
                                                 PREFIX ""
                                                 LIBRARY_OUTPUT_DIRECTORY "${BEAT_CORE_CXX_INTEGERS_ECHO_ANALYZER_SOURCE_DIR}"
)