diff --git a/cmake/modules/FindOpenVDB.cmake b/cmake/modules/FindOpenVDB.cmake index 3e9e5f082..b56a7c3cc 100644 --- a/cmake/modules/FindOpenVDB.cmake +++ b/cmake/modules/FindOpenVDB.cmake @@ -518,12 +518,19 @@ list(REMOVE_DUPLICATES OpenVDB_LIBRARY_DIRS) foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS}) if(NOT TARGET OpenVDB::${COMPONENT}) + if (${COMPONENT} STREQUAL openvdb) + include (${CMAKE_CURRENT_LIST_DIR}/CheckAtomic.cmake) + set(_LINK_LIBS _OPENVDB_VISIBLE_DEPENDENCIES ${CMAKE_REQUIRED_LIBRARIES}) + else () + set(_LINK_LIBS _OPENVDB_VISIBLE_DEPENDENCIES) + endif () + add_library(OpenVDB::${COMPONENT} UNKNOWN IMPORTED) set_target_properties(OpenVDB::${COMPONENT} PROPERTIES INTERFACE_COMPILE_OPTIONS "${OpenVDB_DEFINITIONS}" INTERFACE_INCLUDE_DIRECTORIES "${OpenVDB_INCLUDE_DIR}" IMPORTED_LINK_DEPENDENT_LIBRARIES "${_OPENVDB_HIDDEN_DEPENDENCIES}" # non visible deps - INTERFACE_LINK_LIBRARIES "${_OPENVDB_VISIBLE_DEPENDENCIES}" # visible deps (headers) + INTERFACE_LINK_LIBRARIES "${_LINK_LIBS}" # visible deps (headers) INTERFACE_COMPILE_FEATURES cxx_std_11 IMPORTED_LOCATION "${OpenVDB_${COMPONENT}_LIBRARY}" )