cmake: Fix malformed CMake package location on Windows

CMake doesn't expect CMake package files to be separated in
subdirectories on Windows and instead expects all files to be put in
a single directory `cmake` found within one of the PREFIX paths.

Also fixes circular dependency in w32-pthreads CMake package config
file.
This commit is contained in:
PatTheMav 2024-08-11 16:16:50 +02:00 • committed by Ryan Foster
commit c89cef3aa5
2 changed files with 6 additions and 2 deletions

View file

@ -292,7 +292,11 @@ function(target_export target)
set(package_destination "Frameworks/${target}.framework/Resources/cmake")
set(include_destination "Frameworks/${target}.framework/Headers")
else()
set(package_destination "${OBS_CMAKE_DESTINATION}/${target}")
if(OS_WINDOWS)
set(package_destination "${OBS_CMAKE_DESTINATION}")
else()
set(package_destination "${OBS_CMAKE_DESTINATION}/${target}")
endif()
set(include_destination "${OBS_INCLUDE_DESTINATION}")
endif()

View file

@ -1,4 +1,4 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")
check_required_components("w32-pthreads")