From cb9c588541bcbadda691ff70194812dd6bfabdf8 Mon Sep 17 00:00:00 2001 From: xuwei06 Date: Fri, 2 Jun 2017 10:09:07 -0700 Subject: [PATCH] Add GLOBAL option for external library targets So that they can be found when paddle is built as a add_subdirectory project in another project. --- cmake/external/gflags.cmake | 8 ++++---- cmake/external/glog.cmake | 2 +- cmake/external/gtest.cmake | 10 +++++----- cmake/external/warpctc.cmake | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmake/external/gflags.cmake b/cmake/external/gflags.cmake index 30027a336c..a0d0a892c4 100644 --- a/cmake/external/gflags.cmake +++ b/cmake/external/gflags.cmake @@ -1,11 +1,11 @@ # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,7 +44,7 @@ ExternalProject_Add( -DCMAKE_BUILD_TYPE:STRING=Release ) -ADD_LIBRARY(gflags STATIC IMPORTED) +ADD_LIBRARY(gflags STATIC IMPORTED GLOBAL) SET_PROPERTY(TARGET gflags PROPERTY IMPORTED_LOCATION ${GFLAGS_LIBRARIES}) ADD_DEPENDENCIES(gflags extern_gflags) diff --git a/cmake/external/glog.cmake b/cmake/external/glog.cmake index fa9a509287..b70e94a170 100644 --- a/cmake/external/glog.cmake +++ b/cmake/external/glog.cmake @@ -48,7 +48,7 @@ ExternalProject_Add( -DCMAKE_BUILD_TYPE:STRING=Release ) -ADD_LIBRARY(glog STATIC IMPORTED) +ADD_LIBRARY(glog STATIC IMPORTED GLOBAL) SET_PROPERTY(TARGET glog PROPERTY IMPORTED_LOCATION ${GLOG_LIBRARIES}) ADD_DEPENDENCIES(glog extern_glog) diff --git a/cmake/external/gtest.cmake b/cmake/external/gtest.cmake index 386204dc37..77e06e983e 100644 --- a/cmake/external/gtest.cmake +++ b/cmake/external/gtest.cmake @@ -1,11 +1,11 @@ # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -56,11 +56,11 @@ IF(WITH_TESTING) -DCMAKE_BUILD_TYPE:STRING=Release ) - ADD_LIBRARY(gtest STATIC IMPORTED) + ADD_LIBRARY(gtest STATIC IMPORTED GLOBAL) SET_PROPERTY(TARGET gtest PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARIES}) ADD_DEPENDENCIES(gtest extern_gtest) - ADD_LIBRARY(gtest_main STATIC IMPORTED) + ADD_LIBRARY(gtest_main STATIC IMPORTED GLOBAL) SET_PROPERTY(TARGET gtest_main PROPERTY IMPORTED_LOCATION ${GTEST_MAIN_LIBRARIES}) ADD_DEPENDENCIES(gtest_main extern_gtest) diff --git a/cmake/external/warpctc.cmake b/cmake/external/warpctc.cmake index 367d5b98c7..2d7daed9bc 100644 --- a/cmake/external/warpctc.cmake +++ b/cmake/external/warpctc.cmake @@ -1,11 +1,11 @@ # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -65,7 +65,7 @@ ExternalProject_Add( -DCMAKE_INSTALL_PREFIX:PATH=${WARPCTC_INSTALL_DIR} ) -ADD_LIBRARY(warpctc STATIC IMPORTED) +ADD_LIBRARY(warpctc STATIC IMPORTED GLOBAL) SET_PROPERTY(TARGET warpctc PROPERTY IMPORTED_LOCATION ${WARPCTC_LIBRARIES}) ADD_DEPENDENCIES(warpctc extern_warpctc) -- GitLab