Skip to content

Commit d0c7b0b

Browse files
committed
Uses interface.
Signed-off-by: Andre Pradhana <[email protected]>
1 parent 1ea95f8 commit d0c7b0b

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

openvdb_cmd/vdb_tool/CMakeLists.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,28 @@ if(OPENVDB_TOOL_USE_ALL)
4545
endif()
4646

4747
if(OPENVDB_TOOL_USE_NANO)
48-
target_compile_definitions(vdb_tool_common PUBLIC "VDB_TOOL_USE_NANO")
48+
target_compile_definitions(vdb_tool_common INTERFACE "VDB_TOOL_USE_NANO")
4949
if(OPENVDB_TOOL_NANO_USE_ZIP)
50-
target_compile_definitions(vdb_tool_common PUBLIC "NANOVDB_USE_ZIP")
50+
target_compile_definitions(vdb_tool_common INTERFACE "NANOVDB_USE_ZIP")
5151
find_package(ZLIB REQUIRED)
5252
target_link_libraries(vdb_tool_common INTERFACE ZLIB::ZLIB)
5353
endif()
5454
if(OPENVDB_TOOL_NANO_USE_BLOSC)
55-
target_compile_definitions(vdb_tool_common PUBLIC "NANOVDB_USE_BLOSC")
55+
target_compile_definitions(vdb_tool_common INTERFACE "NANOVDB_USE_BLOSC")
5656
find_package(Blosc REQUIRED)
5757
target_link_libraries(vdb_tool_common INTERFACE blosc)
5858
endif()
59-
target_include_directories(vdb_tool_common INTERFACE ${PROJECT_SOURCE_DIR}/../nanovdb/)
59+
#target_include_directories(vdb_tool_common INTERFACE ${PROJECT_SOURCE_DIR}/../nanovdb/)
60+
if(NOT OPENVDB_BUILD_NANOVDB)
61+
message(FATAL_ERROR "Please pass -DUSE_NANOVDB=ON as a cmake argument.")
62+
else()
63+
set(NANOVDB_LIB nanovdb)
64+
endif()
65+
target_link_libraries(vdb_tool_common INTERFACE ${NANOVDB_LIB})
6066
endif()
6167

6268
if(OPENVDB_TOOL_USE_PNG)
63-
target_compile_definitions(vdb_tool_common PUBLIC "VDB_TOOL_USE_PNG")
69+
target_compile_definitions(vdb_tool_common INTERFACE "VDB_TOOL_USE_PNG")
6470
if(WIN32)
6571
find_package(libpng CONFIG REQUIRED)
6672
else()
@@ -70,20 +76,20 @@ if(OPENVDB_TOOL_USE_PNG)
7076
endif()
7177

7278
if(OPENVDB_TOOL_USE_JPG)
73-
target_compile_definitions(vdb_tool_common PUBLIC "VDB_TOOL_USE_JPG")
79+
target_compile_definitions(vdb_tool_common INTERFACE "VDB_TOOL_USE_JPG")
7480
find_package(JPEG REQUIRED)
7581
target_link_libraries(vdb_tool_common INTERFACE ${JPEG_LIBRARIES})
7682
target_include_directories(vdb_tool_common INTERFACE ${JPEG_INCLUDE_DIR})
7783
endif()
7884

7985
if(OPENVDB_TOOL_USE_EXR)
80-
target_compile_definitions(vdb_tool_common PUBLIC "VDB_TOOL_USE_EXR")
86+
target_compile_definitions(vdb_tool_common INTERFACE "VDB_TOOL_USE_EXR")
8187
find_package(OpenEXR REQUIRED)
8288
target_link_libraries(vdb_tool_common INTERFACE OpenEXR::IlmImf)
8389
endif()
8490

8591
if(OPENVDB_TOOL_USE_ABC)
86-
target_compile_definitions(vdb_tool_common PUBLIC "VDB_TOOL_USE_ABC")
92+
target_compile_definitions(vdb_tool_common INTERFACE "VDB_TOOL_USE_ABC")
8793
find_package(Alembic CONFIG REQUIRED)
8894
target_link_libraries(vdb_tool_common INTERFACE Alembic::Alembic)
8995
endif()

0 commit comments

Comments
 (0)