提交 d8c8f419 编写于 作者: L liaogang

support build majel in subdir

上级 92e0c893
build
third-party
\ No newline at end of file
cmake_minimum_required(VERSION 3.0)
if(GTEST_INCLUDE_DIR AND GTEST_LIBRARIES)
message("-- Found gtest (include: ${GTEST_INCLUDE_DIR}, library: ${GTEST_LIBRARIES})")
else()
# 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")
# 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)
endif()
########################### Build Majel #############################
set(MAJEL_CXX_FILES place.cpp)
set(MAJEL_CUDA_FILES "")
......@@ -6,10 +29,6 @@ if(CUDA_FOUND)
else()
add_library(majel ${MAJEL_CXX_FILES})
endif()
########################### Build Majel #############################
file(GLOB_RECURSE CHECK_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.cpp" "*.h")
add_style_check_target(majel ${CHECK_FILES})
if(WITH_TESTING)
add_subdirectory(test)
endif()
add_subdirectory(test)
file(GLOB_RECURSE ALL_TEST_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.cpp" "*.cc")
add_executable(majel_tests ${ALL_TEST_FILES})
add_dependencies(majel_tests majel ${external_project_dependencies})
add_dependencies(majel_tests majel)
target_link_libraries(majel_tests
${Boost_LIBRARIES}
${GTEST_LIBRARIES}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册