-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #12257 from Eran: Catch2 v3.4 as static lib; U22 in GHA
- Loading branch information
Showing
13 changed files
with
88 additions
and
17,792 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
project(catch2-download NONE) | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add( | ||
catch2 | ||
PREFIX . | ||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git | ||
GIT_TAG v3.4.0 | ||
GIT_CONFIG advice.detachedHead=false # otherwise we'll get "You are in 'detached HEAD' state..." | ||
SOURCE_DIR "${CMAKE_BINARY_DIR}/third-party/catch2" | ||
GIT_SHALLOW 1 # No history needed (requires cmake 3.6) | ||
# Override default steps with no action, we just want the clone step. | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
include(ExternalProject) | ||
|
||
|
||
# We use a function to enforce a scoped variables creation only for the build | ||
# (i.e turn off BUILD_SHARED_LIBS which is used on LRS build as well) | ||
function(get_catch2) | ||
|
||
message( STATUS "Fetching Catch2..." ) | ||
|
||
# We want to clone the repo and build it here, during configuration, so we can use it. | ||
# But ExternalProject_add is limited in that it only does its magic during build. | ||
# This is possible in CMake 3.12+ with FetchContent and FetchContent_MakeAvailable in 3.14+ (meaning Ubuntu 20) | ||
# but we need to adhere to CMake 3.10 (Ubuntu 18). | ||
# So instead, we invoke a new CMake project just to download it: | ||
configure_file( CMake/catch2-download.cmake.in | ||
${CMAKE_BINARY_DIR}/external-projects/catch2-download/CMakeLists.txt ) | ||
execute_process( COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . | ||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} | ||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/external-projects/catch2-download" | ||
OUTPUT_QUIET | ||
RESULT_VARIABLE configure_ret ) | ||
execute_process( COMMAND "${CMAKE_COMMAND}" --build . | ||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/external-projects/catch2-download" | ||
OUTPUT_QUIET | ||
RESULT_VARIABLE build_ret ) | ||
|
||
if( configure_ret OR build_ret ) | ||
message( FATAL_ERROR "Failed to download catchorg/catch2" ) | ||
endif() | ||
|
||
# We use cached variables so the default parameter inside the sub directory will not override the required values | ||
# We add "FORCE" so that is a previous cached value is set our assignment will override it. | ||
set( CATCH_INSTALL_DOCS OFF CACHE INTERNAL "" FORCE ) | ||
set( CATCH_INSTALL_EXTRAS OFF CACHE INTERNAL "" FORCE ) | ||
|
||
add_subdirectory( "${CMAKE_BINARY_DIR}/third-party/catch2" | ||
"${CMAKE_BINARY_DIR}/third-party/catch2/build" ) | ||
|
||
# place libraries with other 3rd-party projects | ||
set_target_properties( Catch2 Catch2WithMain PROPERTIES | ||
FOLDER "ExternalProjectTargets/catch2" ) | ||
|
||
message( STATUS "Fetching Catch2 - Done" ) | ||
|
||
endfunction() | ||
|
||
|
||
get_catch2() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.