From 65a3d0d87d18a7c9a8876c30f31cbf3472f54374 Mon Sep 17 00:00:00 2001 From: Tal Regev Date: Wed, 16 Aug 2023 20:07:00 +0300 Subject: [PATCH] bug fix: - revert tbb changes - unset(freeimage_FOUND CACHE) - unset(tinyxml_FOUND CACHE) - set(Simbody_LIBRARIES ${Simbody_STATIC_LIBRARIES}) when ${Simbody_LIBRARIES} not found. this is static build case --- cmake/FindFreeimage.cmake | 2 ++ cmake/SearchForStuff.cmake | 16 ++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/cmake/FindFreeimage.cmake b/cmake/FindFreeimage.cmake index 53211ce725..9b04450a54 100644 --- a/cmake/FindFreeimage.cmake +++ b/cmake/FindFreeimage.cmake @@ -10,6 +10,8 @@ if (PKG_CONFIG_FOUND) endif (NOT freeimage_FOUND) endif (PKG_CONFIG_FOUND) if (NOT freeimage_FOUND) + # Workaround for CMake bug https://gitlab.kitware.com/cmake/cmake/issues/17135 + unset(freeimage_FOUND CACHE) find_package(freeimage CONFIG) if (freeimage_FOUND) set(freeimage_LIBRARIES freeimage::FreeImage) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index fa00cca590..c2e6d39419 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -166,9 +166,9 @@ if (PKG_CONFIG_FOUND) #list(APPEND CMAKE_MODULE_PATH ${SimTK_INSTALL_PREFIX}/share/cmake) find_package(Simbody) if (Simbody_FOUND) - # When simbody is found but it don't define any libs, we should manually define the libs. + # When simbody is found but it static libs, we need to add it manually. if ("${Simbody_LIBRARIES}" STREQUAL "" OR "${Simbody_LIBRARIES}" STREQUAL "Simbody_LIBRARIES-NOTFOUND") - set(Simbody_LIBRARIES SimTKmath SimTKcommon SimTKsimbody) + set(Simbody_LIBRARIES ${Simbody_STATIC_LIBRARIES}), endif() set (HAVE_SIMBODY TRUE) else() @@ -218,6 +218,8 @@ if (PKG_CONFIG_FOUND) message (STATUS "Using system tinyxml.") pkg_check_modules(tinyxml tinyxml) if (NOT tinyxml_FOUND) + # Workaround for CMake bug https://gitlab.kitware.com/cmake/cmake/issues/17135 + unset(tinyxml_FOUND CACHE) find_package(tinyxml CONFIG) if (tinyxml_FOUND) message (STATUS "tinyxml found via find_package") @@ -336,16 +338,10 @@ if (PKG_CONFIG_FOUND) ################################################# # Find TBB - find_package(TBB CONFIG REQUIRED) - if (TBB_FOUND) - set(TBB_LIBRARIES TBB::tbb TBB::tbbmalloc) - message (STATUS "TBB version: " ${TBB_VERSION}) - endif() - if (NOT TBB_FOUND) - pkg_check_modules(TBB tbb) - endif() + pkg_check_modules(TBB tbb) set (TBB_PKG_CONFIG "tbb") if (NOT TBB_FOUND) + message(STATUS "TBB not found, attempting to detect manually") set (TBB_PKG_CONFIG "")