@@ -328,7 +328,7 @@ else()
328328
329329 set (PACKAGES_DIR ${CMAKE_BINARY_DIR} /packages)
330330
331- file (GLOB_RECURSE PACKAGES " ${PREBUILT_DIR} /*${CMAKE_STATIC_LIBRARY_SUFFIX} " )
331+ file (GLOB_RECURSE PACKAGES ${PREBUILT_DIR} /*${CMAKE_STATIC_LIBRARY_SUFFIX} )
332332
333333 # Extract the object files from our various packages.
334334
@@ -497,6 +497,23 @@ else()
497497 set (CMAKE_PACKAGE_DIR lib/cmake/${CMAKE_PROJECT_NAME} )
498498endif ()
499499
500+ if (NOT LIBOPENCOR_SHARED_LIBS)
501+ # Patch the generated libOpenCORTargets.cmake file by removing the INTERFACE_LINK_LIBRARIES line. Indeed, it lists
502+ # all the third-party libraries used by libOpenCOR. However, the way we build the static version of libOpenCOR (so
503+ # that it embeds all of its dependencies) means that we don't need and, in fact, don't want to list them. (Don't
504+ # want because otherwise CMake might complain that it cannot find libOpenCOR's "dependencies".)
505+ # Note: rather than patching libOpenCORTargets.cmake, we could use
506+ # set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES INTERFACE_LINK_LIBRARIES "")
507+ # but this will fail our Python bindings. So, we patch libOpenCORTargets.cmake instead.
508+
509+ set (PATCH_CMAKE_FILE ${CMAKE_CURRENT_BINARY_DIR} /patch.cmake)
510+
511+ configure_file (${PROJECT_SOURCE_DIR} /cmake/packaging/patch.cmake.in ${PATCH_CMAKE_FILE} @ONLY )
512+
513+ add_custom_command (TARGET ${CMAKE_PROJECT_NAME} PRE_BUILD
514+ COMMAND ${CMAKE_COMMAND} -P ${PATCH_CMAKE_FILE} )
515+ endif ()
516+
500517install (EXPORT ${CMAKE_PROJECT_NAME} Targets
501518 FILE ${CMAKE_PROJECT_NAME} Targets .cmake
502519 DESTINATION ${CMAKE_PACKAGE_DIR} )
0 commit comments