diff --git a/paddle/majel/CMakeLists.txt b/paddle/majel/CMakeLists.txt index baa3bb9e914b3053a18dc638146325ffe3d28a12..34a4ad58f4733ca6f79b73d96ca12c818badb229 100644 --- a/paddle/majel/CMakeLists.txt +++ b/paddle/majel/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.0) -if(GTEST_INCLUDE_DIR AND GTEST_LIBRARIES) - message("-- Found gtest (include: ${GTEST_INCLUDE_DIR}, library: ${GTEST_LIBRARIES})") -else() +if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) # find #include get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) include_directories(${PARENT_DIR}) @@ -18,6 +16,8 @@ else() set(THIRD_PARTY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/third_party) set(WITH_TESTING ON) include(external/gtest) +else() + message("-- Found gtest (include: ${GTEST_INCLUDE_DIR}, library: ${GTEST_LIBRARIES})") endif() ########################### Build Majel ############################# @@ -29,6 +29,9 @@ if(CUDA_FOUND) else() add_library(majel ${MAJEL_CXX_FILES}) endif() +add_dependencies(majel ${external_project_dependencies}) ##################################################################### -add_subdirectory(test) +if(WITH_TESTING) + add_subdirectory(test) +endif() \ No newline at end of file