File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,16 @@ function(find_catch2)
1919 if (TARGET Catch2::Catch2)
2020 # nothing to do, target already exists in the superbuild
2121 elseif (openPMD_USE_INTERNAL_CATCH AND openPMD_catch_src)
22+ # Ensure Catch2 is built with PIC so it can be linked into shared libraries
23+ set (CMAKE_POSITION_INDEPENDENT_CODE ON )
2224 add_subdirectory (${openPMD_catch_src} _deps/localCatch2-build /)
2325 elseif (openPMD_USE_INTERNAL_CATCH AND (openPMD_catch_tar OR openPMD_catch_branch))
2426 include (FetchContent)
27+ # Ensure Catch2 is built with PIC so it can be linked into shared libraries
28+ # Set as cache variable (only if not already set) so it's picked up by Catch2's CMakeLists.txt
29+ if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE )
30+ set (CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Position independent code" )
31+ endif ()
2532 if (openPMD_catch_tar)
2633 FetchContent_Declare(fetchedCatch2
2734 URL ${openPMD_catch_tar}
You can’t perform that action at this time.
0 commit comments