From df9804d20a75d76b8e0099252f2d4751767dadda Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 16 Jun 2023 11:51:57 -0700 Subject: [PATCH] CMake targets fixes for optional vs. required packages (#121) --- CMakeLists.txt | 8 ++++---- build/UVAtlas-config.cmake.in | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d20ff4ca..d29f444a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,7 @@ if(ENABLE_USE_EIGEN) message(STATUS "Using Eigen3 & Spectra for CSymmetricMatrix::GetEigen.") find_package(Eigen3 REQUIRED) find_package(spectra REQUIRED) - target_link_libraries(${PROJECT_NAME} PRIVATE Eigen3::Eigen Spectra::Spectra) + target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen Spectra::Spectra) target_compile_definitions(${PROJECT_NAME} PRIVATE UVATLAS_USE_EIGEN) endif() @@ -254,7 +254,7 @@ if(BUILD_TOOLS AND WIN32) UVAtlasTool/Mesh.h UVAtlasTool/MeshOBJ.cpp UVAtlasTool/SDKMesh.h) - target_link_libraries(uvatlastool + target_link_libraries(uvatlastool PRIVATE ${PROJECT_NAME} ole32.lib version.lib Microsoft::DirectXMesh @@ -263,11 +263,11 @@ if(BUILD_TOOLS AND WIN32) source_group(uvatlastool REGULAR_EXPRESSION UVAtlasTool/*.*) if(UVATLAS_USE_OPENMP) - target_link_libraries(uvatlastool OpenMP::OpenMP_CXX) + target_link_libraries(uvatlastool PRIVATE OpenMP::OpenMP_CXX) endif() if(directxmath_FOUND) - target_link_libraries(uvatlastool Microsoft::DirectXMath) + target_link_libraries(uvatlastool PRIVATE Microsoft::DirectXMath) endif() endif() diff --git a/build/UVAtlas-config.cmake.in b/build/UVAtlas-config.cmake.in index a68ee640..a24b7461 100644 --- a/build/UVAtlas-config.cmake.in +++ b/build/UVAtlas-config.cmake.in @@ -15,8 +15,11 @@ if (ENABLE_USE_EIGEN) endif() if(MINGW OR (NOT WIN32)) - find_dependency(directx-headers CONFIG) - find_dependency(directxmath CONFIG) + find_dependency(directx-headers) + find_dependency(directxmath) +else() + find_package(directx-headers CONFIG QUIET) + find_package(directxmath CONFIG QUIET) endif() check_required_components("@PROJECT_NAME@")