Skip to content

Commit

Permalink
CMake targets fixes for optional vs. required packages (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Jun 16, 2023
1 parent 1226726 commit df9804d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand All @@ -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()

Expand Down
7 changes: 5 additions & 2 deletions build/UVAtlas-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@")

0 comments on commit df9804d

Please sign in to comment.