From 27f49d4ba0b683d2ebc4cf2a342656e5f145f7c7 Mon Sep 17 00:00:00 2001 From: Jason Carrete Date: Wed, 29 Jan 2025 20:18:55 -0500 Subject: [PATCH 1/2] Update CMakeLists.txt to fix deprecation warnings --- reference/CMakeLists.txt | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/reference/CMakeLists.txt b/reference/CMakeLists.txt index df4d9fe4..44e6d250 100644 --- a/reference/CMakeLists.txt +++ b/reference/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2020-2023 Comcast Cable Communications Management, LLC +# Copyright 2020-2025 Comcast Cable Communications Management, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,23 +22,18 @@ project(tasecureapi) option(BUILD_TESTS "Builds and installs the unit tests" ON) option(BUILD_DOC "Build documentation" ON) -if(${BUILD_TESTS}) - # Download and unpack googletest at configure time +if(BUILD_TESTS) include(FetchContent) + + # Download and unpack googletest at configure time FetchContent_Declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG v1.13.0 + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.15.2 ) + FetchContent_MakeAvailable(googletest) - FetchContent_GetProperties(googletest) - if(NOT googletest_POPULATED) - FetchContent_Populate(googletest) - add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL) - endif() - - set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) - include(CTest) + enable_testing() include(GoogleTest) endif() From 0b31078f6c26e1a8b66e367281fdf596b47820a7 Mon Sep 17 00:00:00 2001 From: Jason Carrete Date: Thu, 30 Jan 2025 15:58:59 -0500 Subject: [PATCH 2/2] Revert back to including CTest The CTest module, in addition to providing a bunch of extra targets related to testing, also includes functionality for Coverage and MemCheck. Better to leave this as-is despite it being kinda hacky. --- reference/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reference/CMakeLists.txt b/reference/CMakeLists.txt index 44e6d250..19d1cbd3 100644 --- a/reference/CMakeLists.txt +++ b/reference/CMakeLists.txt @@ -33,7 +33,13 @@ if(BUILD_TESTS) ) FetchContent_MakeAvailable(googletest) - enable_testing() + # The following line is a hack to avoid adding a bunch of CTest targets to + # the build. By setting this internal property used by the CTest module and + # its dependencies, it skips the generation of the extra targets. This + # property could change in the future. + # - https://stackoverflow.com/a/57240389 + set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) + include(CTest) include(GoogleTest) endif()