From: 박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 Date: Thu, 10 May 2018 01:37:45 +0000 (+0900) Subject: Add ExternalProjectTools (#213) X-Git-Tag: nncc_backup~2700 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7fdb91da481850479907cf261f18e96750d9745c;p=platform%2Fcore%2Fml%2Fnnfw.git Add ExternalProjectTools (#213) This commit introduces ExternalProjectTools module which allows users to import external CMake projects in a systematic way. Signed-off-by: Jonghyun Park --- diff --git a/cmake/packages/ExternalProjectToolsConfig.cmake b/cmake/packages/ExternalProjectToolsConfig.cmake new file mode 100644 index 0000000..7dde65f --- /dev/null +++ b/cmake/packages/ExternalProjectToolsConfig.cmake @@ -0,0 +1,5 @@ +macro(add_extdirectory DIR TAG) + add_subdirectory(${DIR} "${CMAKE_BINARY_DIR}/externals/${TAG}") +endmacro(add_extdirectory) + +set(ExternalProjectTools_FOUND TRUE) diff --git a/cmake/packages/GFlagsConfig.cmake b/cmake/packages/GFlagsConfig.cmake index f93c784..b4545f5 100644 --- a/cmake/packages/GFlagsConfig.cmake +++ b/cmake/packages/GFlagsConfig.cmake @@ -7,11 +7,12 @@ function(_GFlags_import) nncc_find_package(GFlagsSource QUIET) if(GFlagsSource_FOUND) + nncc_find_package(ExternalProjectTools REQUIRED) # build static multi-thread library set(GFLAGS_BUILD_STATIC_LIB On) set(GFLAGS_BUILD_gflags_LIB On) set(GFLAGS_BUILD_gflags_nothreads_LIB Off) - add_subdirectory(${GFLAGS_SOURCE_DIR} external/gflags) + add_extdirectory(${GFLAGS_SOURCE_DIR} gflags) else(GFlagsSource_FOUND) set(GFLAGS_ROOT_DIR "" CACHE PATH "Folder contains GFlags") find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h PATHS ${GFLAGS_ROOT_DIR}) diff --git a/cmake/packages/GTestConfig.cmake b/cmake/packages/GTestConfig.cmake index f868727..6698c92 100644 --- a/cmake/packages/GTestConfig.cmake +++ b/cmake/packages/GTestConfig.cmake @@ -1,5 +1,6 @@ if(${BUILD_GTEST}) nncc_find_package(ExternalSourceTools REQUIRED) + nncc_find_package(ExternalProjectTools REQUIRED) nncc_find_package(OptionTools REQUIRED) envoption(GTEST_URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz) @@ -7,7 +8,7 @@ if(${BUILD_GTEST}) ExternalSource_Download(GTEST ${GTEST_URL}) if(NOT TARGET gtest_main) - add_subdirectory(${GTEST_SOURCE_DIR} externals/gtest) + add_extdirectory(${GTEST_SOURCE_DIR} gtest) endif(NOT TARGET gtest_main) set(GTest_FOUND TRUE)