From b720fc5a5b0ce18733ab094eb1941adf102ab268 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 16 Jun 2023 11:44:48 -0700 Subject: [PATCH] CMake targets fixes for optional vs. required packages (#105) --- CMakeLists.txt | 6 +++--- build/DirectXMesh-config.cmake.in | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d72c18f..219e9a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,12 +215,12 @@ if(BUILD_TOOLS AND WIN32) Meshconvert/Mesh.h Meshconvert/Mesh.cpp Meshconvert/SDKMesh.h) - target_include_directories(meshconvert PUBLIC MeshConvert Utilities) - target_link_libraries(meshconvert ${PROJECT_NAME} version.lib) + target_include_directories(meshconvert PRIVATE MeshConvert Utilities) + target_link_libraries(meshconvert PRIVATE ${PROJECT_NAME} version.lib) source_group(meshconvert REGULAR_EXPRESSION meshconvert/*.*) if(directxmath_FOUND) - target_link_libraries(meshconvert Microsoft::DirectXMath) + target_link_libraries(meshconvert PRIVATE Microsoft::DirectXMath) endif() endif() diff --git a/build/DirectXMesh-config.cmake.in b/build/DirectXMesh-config.cmake.in index 9e75cd1..f33e496 100644 --- a/build/DirectXMesh-config.cmake.in +++ b/build/DirectXMesh-config.cmake.in @@ -11,8 +11,11 @@ endif() include(CMakeFindDependencyMacro) 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@")