Skip to content
Draft
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
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,12 @@ endif()
################################################################################
# pkg-config support
################################################################################
configure_proj_pc()
option(USE_PKGCONFIG_REQUIRES "Use 'Requires' instead 'Libs' in proj.pc" ON)
set(GENERATED_INSTALL_FILE_DIR "" CACHE PATH
"Directory where generated install files will persist.")
mark_as_advanced(GENERATED_INSTALL_FILE_DIR)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/proj.pc
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
configure_and_install_proj_pc("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

################################################################################
# "make dist" workalike
Expand Down
32 changes: 14 additions & 18 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ else ()
set (MSVC_TOOLSET_MAJOR 0)
endif ()

include(CMakePackageConfigHelpers)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into CMakePackageConfigHelpers, it was on "my list" to look at eventually. You could probably notice that much of the CMake setup was started in 2014 based on CMake 2.6.0, then incrementally modernised over time, so some of these original configurations were probably needed at the time, but now there are better helpers for modern setups.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to wrap up this PR so I can have the relocation I need for my job. I totally get the challenge, it seems like each section gets modernized a bit whenever it is touched so the structure just isn't cohesive. I'll try and make further changes when I have time.


# If this is a regular build (PROJECT_SOURCE_DIR == CMAKE_SOURCE_DIR), export legacy files by default
# Otherwise, this is embedded in another project, only export PROJ target
# cf https://github.com/OSGeo/gdal/issues/5646
Expand All @@ -102,29 +104,23 @@ foreach (PROJECT_VARIANT_NAME IN LISTS PROJECT_LIST)
# be relocated.)
file (RELATIVE_PATH PROJECT_ROOT_DIR
${CMAKE_INSTALL_PREFIX}/${CMAKECONFIGSUBDIR} ${CMAKE_INSTALL_PREFIX})
configure_file (project-config.cmake.in
project-${PROJECT_VARIANT_LOWER}-config.cmake @ONLY)
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/project-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_VARIANT_LOWER}-config.cmake
INSTALL_DESTINATION "${CMAKECONFIGSUBDIR}"
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_BINDIR
)
configure_file (project-config-version.cmake.in
project-${PROJECT_VARIANT_LOWER}-version.cmake @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/project-${PROJECT_VARIANT_LOWER}-config.cmake"
DESTINATION "${CMAKECONFIGSUBDIR}"
RENAME "${PROJECT_VARIANT_LOWER}-config.cmake")
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_VARIANT_LOWER}-config-version.cmake" @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/project-${PROJECT_VARIANT_LOWER}-version.cmake"
DESTINATION "${CMAKECONFIGSUBDIR}"
RENAME "${PROJECT_VARIANT_LOWER}-config-version.cmake")
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_VARIANT_LOWER}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_VARIANT_LOWER}-config-version.cmake"
DESTINATION "${CMAKECONFIGSUBDIR}")
# Make information about the cmake targets (the library and the tools)
# available.
install(EXPORT targets
NAMESPACE ${PROJECT_NAME}::
FILE ${PROJECT_NAME_LOWER}-targets.cmake
NAMESPACE ${PROJECT_VARIANT_NAME}::
FILE ${PROJECT_VARIANT_LOWER}-targets.cmake
DESTINATION "${CMAKECONFIGSUBDIR}")
if (INSTALL_LEGACY_CMAKE_FILES)
install(EXPORT targets
NAMESPACE ${PROJECT_LEGACY_NAME}::
FILE ${PROJECT_LEGACY_LOWER}-targets.cmake
DESTINATION "${CMAKECONFIGSUBDIR}")
endif()
endforeach ()

72 changes: 64 additions & 8 deletions cmake/ProjUtilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ function(set_variable_from_rel_or_absolute_path var root rel_or_abs_path)
endif()
endfunction()

function(configure_proj_pc)
# Replace with just CMAKE_CURRENT_FUNCTION_LIST_DIR once CMake 3.18
set(PROJ_PC_IN_DIR "${CMAKE_CURRENT_LIST_DIR}")

function(configure_proj_pc DIRECTORY)
set(prefix ${CMAKE_INSTALL_PREFIX})
set_variable_from_rel_or_absolute_path("libdir" "$\{prefix\}" "${CMAKE_INSTALL_LIBDIR}")
set_variable_from_rel_or_absolute_path("includedir" "$\{prefix\}" "${CMAKE_INSTALL_INCLUDEDIR}")
set_variable_from_rel_or_absolute_path("datarootdir" "$\{prefix\}" "${CMAKE_INSTALL_DATAROOTDIR}")
set(datadir "$\{datarootdir\}")
set_variable_from_rel_or_absolute_path("libdir" "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
set_variable_from_rel_or_absolute_path("includedir" "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
set_variable_from_rel_or_absolute_path("datarootdir" "\${prefix}" "${CMAKE_INSTALL_DATAROOTDIR}")
set(datadir "\${datarootdir}")
set(PACKAGE "proj")
set(VERSION ${PROJ_VERSION})
# Build strings of dependencies (Libs.private, Requires.private)
set(EXTRA_LIBS "${CMAKE_THREAD_LIBS_INIT}")
set(EXTRA_REQUIRES "")
option(USE_PKGCONFIG_REQUIRES "Use 'Requires' instead 'Libs' in proj.pc" ON)
macro(add_module_or_libs MODULE)
if(USE_PKGCONFIG_REQUIRES)
list(APPEND EXTRA_REQUIRES "${MODULE}")
Expand Down Expand Up @@ -94,7 +96,61 @@ function(configure_proj_pc)
list(JOIN EXTRA_REQUIRES " " EXTRA_REQUIRES)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/proj.pc.in
${CMAKE_CURRENT_BINARY_DIR}/proj.pc
${PROJ_PC_IN_DIR}/proj.pc.in
${DIRECTORY}/proj.pc
@ONLY)
endfunction()

# Takes two directories, and create the pkg-config files both
# for the configure time environment and the install environment.
# BUILD_DIRECTORY is where the configure time version should be written
# INSTALL_DIRECTORY is the argument that would otherwise be provided to install(FILES ... DIRECTORY)
function(configure_and_install_proj_pc BUILD_DIRECTORY INSTALL_DIRECTORY)
if(GENERATED_INSTALL_FILE_DIR AND NOT EXISTS "${GENERATED_INSTALL_FILE_DIR}")
file(MAKE_DIRECTORY "${GENERATED_INSTALL_FILE_DIR}")
elseif(GENERATED_INSTALL_FILE_DIR)
if(NOT IS_DIRECTORY "${GENERATED_INSTALL_FILE_DIR}")
message(FATAL_ERROR "GENERATED_INSTALL_FILE_DIR was given but \
${GENERATED_INSTALL_FILE_DIR} already exists and is not a directory.")
endif()
endif()
configure_proj_pc(${BUILD_DIRECTORY})
# This is kind of ridiculous, basically we save all the variables
# that are used to generate the proj.pc except for the INSTALL_PREFIX.
# Then at install time, we load all those variables, include this script file,
# and calculate the output directory potentially in relation to the INSTALL_PREFIX.
# Lastly, the file gets configured again, and written, *not to the install directory itself*
# but instead to the install directory *inside* the DESTDIR environment variable.
# See: https://cmake.org/cmake/help/latest/envvar/DESTDIR.html
install(CODE "cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})\n\
set(GENERATED_INSTALL_FILE_DIR \"${GENERATED_INSTALL_FILE_DIR}\")\n\
set(PROJ_VERSION ${PROJ_VERSION})\n\
set(PROJ_OUTPUT_NAME ${PROJ_OUTPUT_NAME})\n\
set(CMAKE_THREAD_LIBS_INIT ${CMAKE_THREAD_LIBS_INIT})\n\
set(USE_PKGCONFIG_REQUIRES ${USE_PKGCONFIG_REQUIRES})\n\
set(TIFF_ENABLED ${TIFF_ENABLED})\n\
set(CURL_ENABLED ${CURL_ENABLED})\n\
set(WIN32 ${WIN32})\n\
set(MINGW ${MINGW})\n\
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})\n\
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES ${CMAKE_C_IMPLICIT_LINK_LIBRARIES})\n\
set(HAVE_LIBM ${HAVE_LIBM})\n\
set(HAVE_LIBDL ${HAVE_LIBDL})\n\
set(CMAKE_INSTALL_LIBDIR \"${CMAKE_INSTALL_LIBDIR}\")\n\
set(CMAKE_INSTALL_INCLUDEDIR \"${CMAKE_INSTALL_INCLUDEDIR}\")\n\
set(CMAKE_INSTALL_DATAROOTDIR \"${CMAKE_INSTALL_DATAROOTDIR}\")\n\
set(INSTALL_DIRECTORY \"${INSTALL_DIRECTORY}\")\n\
include(\"${PROJ_PC_IN_DIR}/ProjUtilities.cmake\")\n\
set_variable_from_rel_or_absolute_path(\"OUT_DIRECTORY\" \"\${CMAKE_INSTALL_PREFIX}\" \"\${INSTALL_DIRECTORY}\")\n\
if(GENERATED_INSTALL_FILE_DIR)\n\
configure_proj_pc(\"\${GENERATED_INSTALL_FILE_DIR}\")\n\
file(INSTALL \"\${GENERATED_INSTALL_FILE_DIR}/proj.pc\" DESTINATION \"\${OUT_DIRECTORY}\")\n\
else()\n\
string(TIMESTAMP TEMP_DIR \"temp_%Y%m%d_%H%M%S\")\n\
file(MAKE_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}/\${TEMP_DIR}\")\n\
configure_proj_pc(\"${CMAKE_CURRENT_BINARY_DIR}/\${TEMP_DIR}\")\n\
file(INSTALL \"${CMAKE_CURRENT_BINARY_DIR}/\${TEMP_DIR}/proj.pc\" DESTINATION \"\${OUT_DIRECTORY}\")\n\
file(REMOVE_RECURSE \"${CMAKE_CURRENT_BINARY_DIR}/\${TEMP_DIR}\")\n\
endif()\n\
")
endfunction()
File renamed without changes.
107 changes: 70 additions & 37 deletions cmake/project-config-version.cmake.in
Original file line number Diff line number Diff line change
@@ -1,52 +1,85 @@
# Version checking for @PROJECT_VARIANT_NAME@

# This is a variant on the basic version file for the Config-mode of find_package().
# It would normally be used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major version is the same as the current one.
# The variable PROJ_VERSION must be set before calling configure_file().


set (PACKAGE_VERSION "@PROJ_VERSION@")
set (PACKAGE_VERSION_MAJOR "@PROJ_VERSION_MAJOR@")
set (PACKAGE_VERSION_MINOR "@PROJ_VERSION_MINOR@")
set (PACKAGE_VERSION_PATCH "@PROJ_VERSION_PATCH@")

# These variable definitions parallel those in @PROJECT_NAME@'s
# cmake/CMakeLists.txt.
if(NOT PACKAGE_FIND_NAME STREQUAL "@PROJECT_VARIANT_NAME@")
# Check package name (in particular, because of the way cmake finds
# package config files, the capitalization could easily be "wrong").
# This is necessary to ensure that the automatically generated
# variables, e.g., <package>_FOUND, are consistently spelled.
set(PACKAGE_VERSION "package = @PROJECT_VARIANT_NAME@, NOT ${PACKAGE_FIND_NAME}")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if(PACKAGE_FIND_VERSION_RANGE)
# both endpoints of the range must have the expected major version
math(EXPR PACKAGE_VERSION_MAJOR_NEXT "${PACKAGE_VERSION_MAJOR} + 1")
if(NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL PACKAGE_VERSION_MAJOR
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL PACKAGE_VERSION_MAJOR)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL PACKAGE_VERSION_MAJOR_NEXT)))
set(PACKAGE_VERSION_COMPATIBLE FALSE)
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL PACKAGE_VERSION_MAJOR
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
else()
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL PACKAGE_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()

if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
endif()

if (MSVC)
# For checking the compatibility of MSVC_TOOLSET_VERSION; see
# https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp
# Assume major version number is obtained by dropping the last decimal
# digit.
math (EXPR MSVC_TOOLSET_MAJOR "${MSVC_TOOLSET_VERSION}/10")
math(EXPR MSVC_TOOLSET_MAJOR "${MSVC_TOOLSET_VERSION}/10")
# toolset version must be at least as great as @PROJECT_NAME@'s and major versions must match
if(MSVC_TOOLSET_VERSION GREATER_EQUAL @MSVC_TOOLSET_VERSION@ AND
MSVC_TOOLSET_MAJOR EQUAL @MSVC_TOOLSET_MAJOR@)
set(PACKAGE_VERSION "MSVC_TOOLSET_VERSION[${MSVC_TOOLSET_VERSION}] \
incompatible with @MSVC_TOOLSET_VERSION@")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
endif ()

if (NOT PACKAGE_FIND_NAME STREQUAL "@PROJECT_VARIANT_NAME@")
# Check package name (in particular, because of the way cmake finds
# package config files, the capitalization could easily be "wrong").
# This is necessary to ensure that the automatically generated
# variables, e.g., <package>_FOUND, are consistently spelled.
set (REASON "package = @PROJECT_VARIANT_NAME@, NOT ${PACKAGE_FIND_NAME}")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (NOT (APPLE OR (NOT DEFINED CMAKE_SIZEOF_VOID_P) OR
CMAKE_SIZEOF_VOID_P EQUAL "@CMAKE_SIZEOF_VOID_P@"))
# Reject if there's a 32-bit/64-bit mismatch (not necessary with Apple
# since a multi-architecture library is built for that platform).
set (REASON "sizeof(*void) = @CMAKE_SIZEOF_VOID_P@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (MSVC AND NOT (
# toolset version must be at least as great as @PROJECT_NAME@'s
MSVC_TOOLSET_VERSION GREATER_EQUAL @MSVC_TOOLSET_VERSION@
# and major versions must match
AND MSVC_TOOLSET_MAJOR EQUAL @MSVC_TOOLSET_MAJOR@ ))
# Reject if there's a mismatch in MSVC compiler versions
set (REASON "MSVC_TOOLSET_VERSION = @MSVC_TOOLSET_VERSION@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (PACKAGE_FIND_VERSION)
if (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set (PACKAGE_VERSION_EXACT TRUE)
elseif (PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION
AND PACKAGE_FIND_VERSION_MAJOR EQUAL PACKAGE_VERSION_MAJOR)
set (PACKAGE_VERSION_COMPATIBLE TRUE)
endif ()
endif ()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()

# If unsuitable, append the reason to the package version so that it's
# visible to the user.
if (PACKAGE_VERSION_UNSUITABLE)
set (PACKAGE_VERSION "${PACKAGE_VERSION} (${REASON})")
endif ()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
# (not necessary with Apple since a multi-architecture library is built for that platform).
if(NOT APPLE AND NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
76 changes: 26 additions & 50 deletions cmake/project-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,54 @@
#
# Set
# @PROJECT_VARIANT_NAME@_FOUND = 1
# @PROJECT_VARIANT_NAME@_INCLUDE_DIRS = /usr/local/include
# @PROJECT_VARIANT_NAME@_INCLUDE_DIRS = $<INSTALL_PREFIX>/include
# @PROJECT_VARIANT_NAME@_LIBRARY_DIRS = $<INSTALL_PREFIX>/lib
# @PROJECT_VARIANT_NAME@_BINARY_DIRS = $<INSTALL_PREFIX>/bin
# @PROJECT_VARIANT_NAME@_LIBRARIES = @PROJECT_VARIANT_NAME@::proj
# @PROJECT_VARIANT_NAME@_LIBRARY_DIRS = /usr/local/lib
# @PROJECT_VARIANT_NAME@_BINARY_DIRS = /usr/local/bin
# @PROJECT_VARIANT_NAME@_VERSION = 4.9.1 (for example)
if(@PROJECT_VARIANT_NAME@ STREQUAL "PROJ4")

if("@PROJECT_VARIANT_NAME@" STREQUAL "PROJ4")
message(DEPRECATION "find_package(PROJ4) is deprecated and will be retired soon. Please use find_package(PROJ) instead.")
endif()

include(CMakeFindDependencyMacro)
@PACKAGE_INIT@

# We cannot have a find_dependency() call between cmake_policy(PUSH)/cmake_policy(POP)
# because find_dependency() issues a return() on failure, which results in
# imbalanced push/pop
# Cf https://gitlab.kitware.com/cmake/cmake/-/issues/17612
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
if("@ENABLE_TIFF@")
set(PROJ_CONFIG_FIND_TIFF_DEP ON)
endif()
if("@CURL_ENABLED@")
set(PROJ_CONFIG_FIND_CURL_DEP ON)
set_and_check("@PROJECT_VARIANT_NAME@_INCLUDE_DIRS" "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check("@PROJECT_VARIANT_NAME@_LIBRARY_DIRS" "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
set_and_check("@PROJECT_VARIANT_NAME@_BINARY_DIRS" "@PACKAGE_CMAKE_INSTALL_BINDIR@")

if(CMAKE_VERSION VERSION_LESS_EQUAL "2.6.4")
message(SEND_ERROR "CMake version more recent than 2.6.4 required because of CMP0012")
endif()
cmake_policy(POP)

include(CMakeFindDependencyMacro)

find_dependency(SQLite3)

if(DEFINED PROJ_CONFIG_FIND_TIFF_DEP)
find_dependency(TIFF)
if(@ENABLE_TIFF@)
find_dependency(TIFF)
endif()

if(DEFINED PROJ_CONFIG_FIND_CURL_DEP)
if(@CURL_ENABLED@)
# Chainload CURL usage requirements
find_dependency(CURL)
# Target CURL::libcurl only defined since CMake 3.12
if(NOT TARGET CURL::libcurl)
add_library(CURL::libcurl INTERFACE IMPORTED)
set_target_properties(CURL::libcurl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${CURL_LIBRARIES}"
)
add_library(CURL::libcurl INTERFACE IMPORTED)
set_target_properties(CURL::libcurl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${CURL_LIBRARIES}"
)
endif()
endif()

function(set_variable_from_rel_or_absolute_path var root rel_or_abs_path)
if(IS_ABSOLUTE "${rel_or_abs_path}")
set(${var} "${rel_or_abs_path}" PARENT_SCOPE)
else()
set(${var} "${root}/${rel_or_abs_path}" PARENT_SCOPE)
endif()
endfunction()

# Tell the user project where to find our headers and libraries
get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
get_filename_component (_ROOT "${_DIR}/@PROJECT_ROOT_DIR@" ABSOLUTE)
# Use _ROOT as prefix here for the possibility of relocation after installation.
set_variable_from_rel_or_absolute_path("@PROJECT_VARIANT_NAME@_INCLUDE_DIRS" "${_ROOT}" "@CMAKE_INSTALL_INCLUDEDIR@")
set_variable_from_rel_or_absolute_path("@PROJECT_VARIANT_NAME@_LIBRARY_DIRS" "${_ROOT}" "@CMAKE_INSTALL_LIBDIR@")
set_variable_from_rel_or_absolute_path("@PROJECT_VARIANT_NAME@_BINARY_DIRS" "${_ROOT}" "@CMAKE_INSTALL_BINDIR@")

set (@PROJECT_VARIANT_NAME@_LIBRARIES @PROJECT_VARIANT_NAME@::proj)
# Read in the exported definition of the library
include ("${_DIR}/@PROJECT_NAME_LOWER@-targets.cmake")
if (@INSTALL_LEGACY_CMAKE_FILES@)
include ("${_DIR}/@PROJECT_LEGACY_LOWER@-targets.cmake")
endif()

unset (_ROOT)
unset (_DIR)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_VARIANT_LOWER@-targets.cmake")
list(APPEND @PROJECT_VARIANT_NAME@_LIBRARIES @PROJECT_VARIANT_NAME@::proj)

if ("@PROJECT_VARIANT_NAME@" STREQUAL "PROJ4")
# For backward compatibility with old releases of libgeotiff
set (@PROJECT_VARIANT_NAME@_INCLUDE_DIR
${@PROJECT_VARIANT_NAME@_INCLUDE_DIRS})
endif ()

check_required_components(@PROJECT_VARIANT_NAME@)
3 changes: 0 additions & 3 deletions cmake/uninstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
endif()

set(uninstall_file_list "@CMAKE_BINARY_DIR@/install_manifest.txt")
if(EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest_extra.txt")
list(APPEND uninstall_file_list "@CMAKE_CURRENT_BINARY_DIR@/install_manifest_extra.txt")
endif()

set(dir_list)
foreach (manifest_file IN ITEMS ${uninstall_file_list})
Expand Down
Loading
Loading