cmake: more install simplification.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8f8ff4..08e511b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -285,7 +285,7 @@
# rpath handling: use rpath in installed binaries
if(NOT CMAKE_SYSTEM_NAME MATCHES Linux)
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+ set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
@@ -330,9 +330,9 @@
# pkgconfig file
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix \${prefix})
-set(bindir \${exec_prefix}/${CMAKE_INSTALL_BINDIR})
-set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
-set(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
+set(bindir \${exec_prefix}/bin)
+set(libdir \${exec_prefix}/lib)
+set(includedir \${prefix}/include)
if(CMAKE_SYSTEM_NAME MATCHES BSD)
set(PKG_CONFIG_RPATH "-Wl,-R\${libdir}")
endif(CMAKE_SYSTEM_NAME MATCHES BSD)
@@ -462,21 +462,13 @@
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
-target_include_directories(zip
- PUBLIC
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
- $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDE_DIR}>
-)
-
# create package config file
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
COMPATIBILITY AnyNewerVersion)
configure_package_config_file("${PROJECT_NAME}.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
- INSTALL_DESTINATION lib/cmake/libzip
- PATH_VARS CMAKE_INSTALL_BINDIR CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR)
+ INSTALL_DESTINATION lib/cmake/libzip)
if(LIBZIP_DO_INSTALL)
install(EXPORT ${PROJECT_NAME}-targets
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index d710734..6c2f349 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -215,7 +215,11 @@
endif()
target_link_libraries(zip PRIVATE ${ZLIB_LIBRARIES} ${OPTIONAL_LIBRARY})
-target_include_directories(zip BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR})
+target_include_directories(zip
+ PUBLIC
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib>
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
+)
if(LIBZIP_DO_INSTALL)
install(TARGETS zip
diff --git a/libzip.cmake.in b/libzip.cmake.in
index 462439b..c6c600c 100644
--- a/libzip.cmake.in
+++ b/libzip.cmake.in
@@ -1,13 +1,10 @@
@PACKAGE_INIT@
+include(CMakeFindDependencyMacro)
+find_dependency(ZLIB::ZLIB)
+# how to handle the optional dependencies?
# Provide all our library targets to users.
-include("@PACKAGE_CMAKE_INSTALL_LIBDIR@/cmake/libzip/libzip-targets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/libzip-targets.cmake")
-get_filename_component(LIBZIP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-set(LIBZIP_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
-
-set(LIBZIP_LIBRARIES zip)
-set(ZIPCMP_EXECUTABLE zipcmp)
-#set_and_check(ZIPCMP_EXECUTABLE "@PACKAGE_CMAKE_INSTALL_BINDIR@/zipcmp")
check_required_components(libzip)