From 84f95ae2906b3b773eeedce10958f80a2730b606 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 20 Sep 2024 11:08:12 +0200 Subject: [PATCH] Some desperate CMake fixes (see also tm_v8.2) --- CMakeLists.txt | 3 +++ cmake/FindBlosc.cmake | 6 +++++- openvdb/openvdb/CMakeLists.txt | 18 ++++++++++-------- openvdb_cmd/vdb_print/CMakeLists.txt | 1 + 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8329dda947..475ab77b08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,9 @@ if(POLICY CMP0091) cmake_policy(SET CMP0091 NEW) endif() + +find_package(Threads REQUIRED) + ###### Version set(OpenVDB_MAJOR_VERSION 11) diff --git a/cmake/FindBlosc.cmake b/cmake/FindBlosc.cmake index a9c77ae5e7..79b6ba83bc 100644 --- a/cmake/FindBlosc.cmake +++ b/cmake/FindBlosc.cmake @@ -209,7 +209,11 @@ set(Blosc_LIB_COMPONENTS "") list(APPEND BLOSC_BUILD_TYPES DEBUG RELEASE) foreach(BUILD_TYPE ${BLOSC_BUILD_TYPES}) - set(_BLOSC_LIB_NAME blosc) + if(WIN32) + set(_BLOSC_LIB_NAME libblosc) + else() + set(_BLOSC_LIB_NAME blosc) + endif() set(_BLOSC_CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH}) if(VCPKG_TOOLCHAIN) diff --git a/openvdb/openvdb/CMakeLists.txt b/openvdb/openvdb/CMakeLists.txt index 33d4e5cc85..171b3df0b2 100644 --- a/openvdb/openvdb/CMakeLists.txt +++ b/openvdb/openvdb/CMakeLists.txt @@ -108,6 +108,8 @@ endif() # Collect and configure lib dependencies +find_package(Threads REQUIRED) + if(OPENVDB_USE_DELAYED_LOADING) find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams) else() @@ -670,14 +672,14 @@ if(OPENVDB_CORE_STATIC) PROPERTIES OUTPUT_NAME ${OPENVDB_STATIC_LIBRARY_NAME}) if(MSVC) - if(NOT CMAKE_MSVC_RUNTIME_LIBRARY) - # NOTE: MSVC_RUNTIME_LIBRARY does not propagate to targets, so - # also add it explicitly as a compile option - set_target_properties(openvdb_static PROPERTIES - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - target_compile_options(openvdb_static PUBLIC - "$<$:/MT$<$:d>>") - endif() + #if(NOT CMAKE_MSVC_RUNTIME_LIBRARY) + # # NOTE: MSVC_RUNTIME_LIBRARY does not propagate to targets, so + # # also add it explicitly as a compile option + # set_target_properties(openvdb_static PROPERTIES + # MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + # target_compile_options(openvdb_static PUBLIC + # "$<$:/MT$<$:d>>") + #endif() set_target_properties(openvdb_static PROPERTIES PREFIX "lib") endif() endif() diff --git a/openvdb_cmd/vdb_print/CMakeLists.txt b/openvdb_cmd/vdb_print/CMakeLists.txt index a8911a06d1..1a4ebc6c07 100644 --- a/openvdb_cmd/vdb_print/CMakeLists.txt +++ b/openvdb_cmd/vdb_print/CMakeLists.txt @@ -13,6 +13,7 @@ project(VDBPrint LANGUAGES CXX) include(GNUInstallDirs) set(SOURCE_FILES main.cc) +find_package(Threads REQUIRED) add_executable(vdb_print ${SOURCE_FILES}) target_link_libraries(vdb_print ${OPENVDB_BINARIES_DEPENDENT_LIBS})