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: Fix paths in .pc files #815

Merged
merged 2 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions IlmBase/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include(CheckIncludeFiles)
include(CheckSymbolExists)
include(CheckLibraryExists)
include(CheckStructHasMember)
include(../../cmake/JoinPaths.cmake)
meshula marked this conversation as resolved.
Show resolved Hide resolved

check_include_files(ucontext.h ILMBASE_HAVE_UCONTEXT_H)
if(ILMBASE_HAVE_UCONTEXT_H)
Expand Down Expand Up @@ -76,8 +77,8 @@ if(ILMBASE_INSTALL_PKG_CONFIG)
function(ilmbase_pkg_config_help pcinfile)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
join_paths(libdir "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
meshula marked this conversation as resolved.
Show resolved Hide resolved
join_paths(includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
set(LIB_SUFFIX_DASH ${ILMBASE_LIB_SUFFIX})
if(TARGET Threads::Threads)
# hrm, can't use properties as they end up as generator expressions
Expand Down
5 changes: 3 additions & 2 deletions OpenEXR/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include(CheckSymbolExists)
include(CheckLibraryExists)
include(CheckStructHasMember)
include(CheckCXXSourceCompiles)
include(../../cmake/JoinPaths.cmake)

if (NOT CMAKE_CROSSCOMPILING AND EXISTS "/proc/self/exe")
set(OPENEXR_IMF_HAVE_LINUX_PROCFS TRUE)
Expand Down Expand Up @@ -76,8 +77,8 @@ if(OPENEXR_INSTALL_PKG_CONFIG)
function(openexr_pkg_config_help pcinfile)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
join_paths(libdir "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
set(LIB_SUFFIX_DASH ${OPENEXR_LIB_SUFFIX})
if(TARGET Threads::Threads)
# hrm, can't use properties as they end up as generator expressions
Expand Down
23 changes: 23 additions & 0 deletions cmake/JoinPaths.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This module provides function for joining paths
# known from from most languages
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenEXR Project.
# https://github.com/jtojnar/cmake-snips
#
# Modelled after Python’s os.path.join
# https://docs.python.org/3.7/library/os.path.html#os.path.join
# Windows not supported
function(join_paths joined_path first_path_segment)
set(temp_path "${first_path_segment}")
foreach(current_segment IN LISTS ARGN)
if(NOT ("${current_segment}" STREQUAL ""))
if(IS_ABSOLUTE "${current_segment}")
set(temp_path "${current_segment}")
else()
set(temp_path "${temp_path}/${current_segment}")
endif()
endif()
endforeach()
set(${joined_path} "${temp_path}" PARENT_SCOPE)
endfunction()