CMakeLists.txt 1.3 KB
Newer Older
L
liaogang 已提交
1 2
cmake_minimum_required(VERSION 3.0)

L
liaogang 已提交
3
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
L
liaogang 已提交
4 5 6 7 8 9 10 11
    # find #include <majel/xx.h>
    get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
    include_directories(${PARENT_DIR})

    # find cmake directory modules
    get_filename_component(PARENT_DIR ${PARENT_DIR} DIRECTORY)
    set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PARENT_DIR}/cmake")

L
liaogang 已提交
12 13 14 15 16 17 18
    # enable boost
    find_package(Boost REQUIRED)
    if(NOT Boost_FOUND)
        message(FATAL "Cannot find Boost library.")
    endif()
    include_directories(${Boost_INCLUDE_DIRS})

L
liaogang 已提交
19 20 21 22 23 24 25
    # enable c++11
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

    # enable gtest
    set(THIRD_PARTY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/third_party)
    set(WITH_TESTING ON)
    include(external/gtest)
L
liaogang 已提交
26 27
else()
    message("-- Found gtest (include: ${GTEST_INCLUDE_DIR}, library: ${GTEST_LIBRARIES})")
L
liaogang 已提交
28 29 30
endif()

########################### Build Majel #############################
L
liaogang 已提交
31
set(MAJEL_CXX_FILES place.cc)
L
liaogang 已提交
32 33 34 35 36 37 38
set(MAJEL_CUDA_FILES "")

if(CUDA_FOUND)
    cuda_add_library(majel ${MAJEL_CUDA_FILES} ${MAJEL_CXX_FILES})
else()
    add_library(majel ${MAJEL_CXX_FILES})
endif()
L
liaogang 已提交
39
add_dependencies(majel ${external_project_dependencies})
L
liaogang 已提交
40
#####################################################################
L
liaogang 已提交
41

L
liaogang 已提交
42 43
if(WITH_TESTING)
    add_subdirectory(test)
L
liaogang 已提交
44
endif()