You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2020/04/20 06:23:40 UTC
[celix] branch feature/update_gtest_config created (now ab4a9ae)
This is an automated email from the ASF dual-hosted git repository.
abroekhuis pushed a change to branch feature/update_gtest_config
in repository https://gitbox.apache.org/repos/asf/celix.git.
at ab4a9ae Updated gtest setup to either use GTest supplied Config file, or (if not found) download via Cmake's FetchContent. Updated usage to correct alias.
This branch includes the following new commits:
new ab4a9ae Updated gtest setup to either use GTest supplied Config file, or (if not found) download via Cmake's FetchContent. Updated usage to correct alias.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[celix] 01/01: Updated gtest setup to either use GTest supplied
Config file,
or (if not found) download via Cmake's FetchContent. Updated usage to
correct alias.
Posted by ab...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
abroekhuis pushed a commit to branch feature/update_gtest_config
in repository https://gitbox.apache.org/repos/asf/celix.git
commit ab4a9ae5364f90815a98a473048a9ca5ecbf1f6e
Author: Alexander Broekhuis <al...@luminis.eu>
AuthorDate: Mon Apr 20 08:23:20 2020 +0200
Updated gtest setup to either use GTest supplied Config file, or (if not found) download via Cmake's FetchContent. Updated usage to correct alias.
---
CMakeLists.txt | 8 ++---
.../pubsub_protocol_wire_v1/gtest/CMakeLists.txt | 2 +-
.../remote_service_admin_dfi/gtest/CMakeLists.txt | 2 +-
cmake/AddGTest.cmake | 39 +++++-----------------
libs/dfi/gtest/CMakeLists.txt | 2 +-
libs/framework/gtest/CMakeLists.txt | 2 +-
6 files changed, 17 insertions(+), 38 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 665eb92..6af1ae9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,9 +18,9 @@
cmake_minimum_required (VERSION 3.2)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0042 NEW)
-#if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.9.0")
-# cmake_policy(SET CMP0068 NEW)
-#endif()
+if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.9.0")
+ cmake_policy(SET CMP0068 NEW)
+endif()
project (Celix C CXX)
@@ -117,7 +117,7 @@ endif ()
option(CELIX_USE_ZIP_INSTEAD_OF_JAR "Default Celix cmake command will use jar to package bundle (if found). This option enforces Celix to use zip instead." OFF)
if (ENABLE_TESTING)
- find_package(GTest QUIET)
+ find_package(GTest CONFIG QUIET)
if (NOT GTest_FOUND)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/AddGTest.cmake)
endif()
diff --git a/bundles/pubsub/pubsub_protocol_wire_v1/gtest/CMakeLists.txt b/bundles/pubsub/pubsub_protocol_wire_v1/gtest/CMakeLists.txt
index 48de96e..741a59a 100644
--- a/bundles/pubsub/pubsub_protocol_wire_v1/gtest/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_protocol_wire_v1/gtest/CMakeLists.txt
@@ -22,7 +22,7 @@ set(SOURCES
add_executable(celix_pswp_tests ${SOURCES})
#target_include_directories(celix_cxx_pswp_tests SYSTEM PRIVATE gtest)
target_include_directories(celix_pswp_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src)
-target_link_libraries(celix_pswp_tests PRIVATE celix_wire_protocol_v1_impl GTest::GTest Celix::pubsub_spi)
+target_link_libraries(celix_pswp_tests PRIVATE celix_wire_protocol_v1_impl GTest::gtest Celix::pubsub_spi)
add_test(NAME celix_pswp_tests COMMAND celix_pswp_tests)
SETUP_TARGET_FOR_COVERAGE(celix_pswp_tests_cov celix_cxx_pswp_tests ${CMAKE_BINARY_DIR}/coverage/bundles/pubsub/protocol_wire_v1 ..)
\ No newline at end of file
diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt b/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt
index 793d167..8b493f1 100644
--- a/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt
+++ b/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt
@@ -46,7 +46,7 @@ target_link_libraries(test_rsa_dfi PRIVATE
Celix::framework
Celix::rsa_common
calculator_api
- GTest::GTest
+ GTest::gtest
)
get_property(rsa_bundle_file TARGET rsa_dfi PROPERTY BUNDLE_FILE)
diff --git a/cmake/AddGTest.cmake b/cmake/AddGTest.cmake
index f5dc360..c57d57b 100644
--- a/cmake/AddGTest.cmake
+++ b/cmake/AddGTest.cmake
@@ -15,37 +15,16 @@
# specific language governing permissions and limitations
# under the License.
-include(ExternalProject)
-ExternalProject_Add(
- googletest_project
+include(FetchContent)
+FetchContent_Declare(
+ googletest
GIT_REPOSITORY https://github.com/google/googletest.git
- GIT_TAG release-1.8.1
- UPDATE_DISCONNECTED TRUE
- PREFIX ${CMAKE_BINARY_DIR}/gtest
- INSTALL_COMMAND ""
+ GIT_TAG release-1.10.0
)
+FetchContent_MakeAvailable(googletest)
-ExternalProject_Get_Property(googletest_project source_dir binary_dir)
+add_library(GTest::gtest ALIAS gtest)
+add_library(GTest::gtest_main ALIAS gtest_main)
-file(MAKE_DIRECTORY ${source_dir}/googletest/include)
-add_library(GTest::GTest IMPORTED STATIC GLOBAL)
-add_dependencies(GTest::GTest googletest_project)
-set_target_properties(GTest::GTest PROPERTIES
- IMPORTED_LOCATION "${binary_dir}/googlemock/gtest/libgtest.a"
- INTERFACE_INCLUDE_DIRECTORIES "${source_dir}/googletest/include"
- )
-add_library(GTest::Main IMPORTED STATIC GLOBAL)
-add_dependencies(GTest::Main googletest_project)
-set_target_properties(GTest::Main PROPERTIES
- IMPORTED_LOCATION "${binary_dir}/googlemock/gtest/libgtest_main.a"
- INTERFACE_INCLUDE_DIRECTORIES "${source_dir}/googletest/include"
- )
-
-
-file(MAKE_DIRECTORY ${source_dir}/googlemock/include)
-add_library(GTest::GMock IMPORTED STATIC GLOBAL)
-add_dependencies(GTest::GMock googletest_project)
-set_target_properties(GTest::GMock PROPERTIES
- IMPORTED_LOCATION "${binary_dir}/googlemock/libgmock.a"
- INTERFACE_INCLUDE_DIRECTORIES "${source_dir}/googlemock/include"
- )
+add_library(GTest::gmock ALIAS gmock)
+add_library(GTest::gmock_main ALIAS gmock_main)
\ No newline at end of file
diff --git a/libs/dfi/gtest/CMakeLists.txt b/libs/dfi/gtest/CMakeLists.txt
index 22ef7e8..4940648 100644
--- a/libs/dfi/gtest/CMakeLists.txt
+++ b/libs/dfi/gtest/CMakeLists.txt
@@ -32,7 +32,7 @@ add_executable(test_dfi
src/avrobin_serialization_tests.cpp
)
-target_link_libraries(test_dfi PRIVATE Celix::dfi Celix::utils FFI::lib Jansson GTest::GTest GTest::Main)
+target_link_libraries(test_dfi PRIVATE Celix::dfi Celix::utils FFI::lib Jansson GTest::gtest GTest::gtest_main)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/schemas DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/descriptors DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/libs/framework/gtest/CMakeLists.txt b/libs/framework/gtest/CMakeLists.txt
index 33cb7b9..9b8e432 100644
--- a/libs/framework/gtest/CMakeLists.txt
+++ b/libs/framework/gtest/CMakeLists.txt
@@ -37,7 +37,7 @@ add_executable(test_framework
src/dm_tests.cpp
)
-target_link_libraries(test_framework Celix::framework CURL::libcurl GTest::GTest)
+target_link_libraries(test_framework Celix::framework CURL::libcurl GTest::gtest)
add_dependencies(test_framework simple_test_bundle1_bundle simple_test_bundle2_bundle simple_test_bundle3_bundle simple_test_bundle4_bundle simple_test_bundle5_bundle bundle_with_exception_bundle unresolveable_bundle_bundle)
target_include_directories(test_framework PRIVATE ../src)