Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake targets fixes for optional vs. required packages #369

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
Texassemble/texassemble.rc
Texassemble/settings.manifest
Texassemble/AnimatedGif.cpp)
target_link_libraries(texassemble ${PROJECT_NAME} ole32.lib version.lib)
target_link_libraries(texassemble PRIVATE ${PROJECT_NAME} ole32.lib version.lib)
source_group(texassemble REGULAR_EXPRESSION Texassemble/*.*)

add_executable(texconv
Expand All @@ -296,24 +296,24 @@ if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
Texconv/settings.manifest
Texconv/ExtendedBMP.cpp
Texconv/PortablePixMap.cpp)
target_link_libraries(texconv ${PROJECT_NAME} ole32.lib shell32.lib version.lib)
target_link_libraries(texconv PRIVATE ${PROJECT_NAME} ole32.lib shell32.lib version.lib)
source_group(texconv REGULAR_EXPRESSION Texconv/*.*)

add_executable(texdiag
Texdiag/texdiag.cpp
Texdiag/texdiag.rc
Texdiag/settings.manifest)
target_link_libraries(texdiag ${PROJECT_NAME} ole32.lib version.lib)
target_link_libraries(texdiag PRIVATE ${PROJECT_NAME} ole32.lib version.lib)
source_group(texdiag REGULAR_EXPRESSION Texdiag/*.*)

if(BC_USE_OPENMP)
target_link_libraries(texconv OpenMP::OpenMP_CXX)
target_link_libraries(texconv PRIVATE OpenMP::OpenMP_CXX)
endif()

if(ENABLE_OPENEXR_SUPPORT)
foreach(t IN LISTS TOOL_EXES)
target_include_directories(${t} PRIVATE Auxiliary)
target_link_libraries(${t} ${OPENEXR_ILMIMF_LIBRARY})
target_link_libraries(${t} PRIVATE ${OPENEXR_ILMIMF_LIBRARY})
target_compile_options(${t} PRIVATE -DUSE_OPENEXR)
endforeach()
endif()
Expand All @@ -337,7 +337,7 @@ if(BUILD_SAMPLE AND BUILD_DX11 AND WIN32)
DDSView/ddsview.cpp
DDSView/ddsview.rc
${COMPILED_DDSVIEW_SHADERS}/ddsview_ps1D.inc)
target_link_libraries(ddsview ${PROJECT_NAME} d3d11.lib ole32.lib)
target_link_libraries(ddsview PRIVATE ${PROJECT_NAME} d3d11.lib ole32.lib)
source_group(ddsview REGULAR_EXPRESSION DDSView/*.*)

target_include_directories(ddsview PRIVATE ${COMPILED_DDSVIEW_SHADERS})
Expand All @@ -356,7 +356,7 @@ endif()

if(directxmath_FOUND)
foreach(t IN LISTS TOOL_EXES)
target_link_libraries(${t} Microsoft::DirectXMath)
target_link_libraries(${t} PRIVATE Microsoft::DirectXMath)
endforeach()
endif()

Expand Down
7 changes: 5 additions & 2 deletions build/DirectXTex-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ if(ENABLE_OPENEXR_SUPPORT)
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@")