-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11a5a4e
commit cecd066
Showing
5 changed files
with
261 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
prefix=@prefix@ | ||
libdir=@libdir@ | ||
includedir=@includedir@ | ||
CXX=@CMAKE_CXX_COMPILER@ @CXX_STD0X_FLAGS@ | ||
CC=@CMAKE_C_COMPILER@ @C_STD99_FLAGS@ | ||
DEPENDENCIES=@PictureIt_LIBRARIES@ | ||
|
||
Name: @name@ | ||
Description: @description@ @major@.@minor@ | ||
Version: @major@.@minor@ | ||
Libs: @target@ @libs@ | ||
Cflags: @CMAKE_CXX_FLAGS@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) | ||
|
||
# It defines the following variables | ||
# PICTUREIT_INCLUDE_DIRS, the paths where dependency headers are located | ||
# PICTUREIT_LIBRARY_DIRS, folder in which the PictureIt library is located | ||
# PICTUREIT_LIBRARIES, libraries used by PictureIt to link against | ||
|
||
set(PICTUREIT_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include | ||
@CMAKE_INSTALL_PREFIX@/include/PictureIt) | ||
set (PICTUREIT_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@") | ||
#set(PICTUREIT_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include | ||
# @CMAKE_INSTALL_PREFIX@/include/PictureIt) | ||
#set (PICTUREIT_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@") | ||
|
||
#FIXME CMAKE_INSTALL_LIBDIR not defined (GNUInstallDirs / MultiArch) | ||
if(WIN32) | ||
set (PICTUREIT_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/PictureIt.lib") | ||
else() | ||
set (PICTUREIT_LIBRARY "-L@CMAKE_INSTALL_PREFIX@/lib -lPictureIt") | ||
endif() | ||
##FIXME CMAKE_INSTALL_LIBDIR not defined (GNUInstallDirs / MultiArch) | ||
#if(WIN32) | ||
# set (PICTUREIT_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/PictureIt.lib") | ||
#else() | ||
# set (PICTUREIT_LIBRARY "-L@CMAKE_INSTALL_PREFIX@/lib -lPictureIt") | ||
#endif() | ||
|
||
#find_library(PICTUREIT_LIBRARY "@PROJECT_NAME@" HINTS ${PICTUREIT_LIBRARY_DIR}) | ||
##find_library(PICTUREIT_LIBRARY "@PROJECT_NAME@" HINTS ${PICTUREIT_LIBRARY_DIR}) | ||
|
||
set(PICTUREIT_LIBRARIES ${PICTUREIT_LIBRARY}) | ||
mark_as_advanced(PICTUREIT_LIBRARIES) | ||
#set(PICTUREIT_LIBRARIES ${PICTUREIT_LIBRARY}) | ||
#mark_as_advanced(PICTUREIT_LIBRARIES) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# translate a list of libraries into a command-line that can be passed to the | ||
# compiler/linker. first parameter is the name of the variable that will | ||
# receive this list, the rest is considered the list of libraries | ||
function (linker_cmdline what INTO outvar FROM) | ||
# if we are going to put these in regexps, we must escape period | ||
string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}") | ||
string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
string (REPLACE "." "\\." esc_ar_pref "${CMAKE_STATIC_LIBRARY_PREFIX}") | ||
string (REPLACE "." "\\." esc_ar_suff "${CMAKE_STATIC_LIBRARY_PREFIX}") | ||
|
||
# CMake loves absolute paths, whereas libtool won't have any of it! | ||
# (you get an error message about argument not parsed). translate each | ||
# of the libraries into a linker option | ||
set (deplib_list "") | ||
foreach (deplib IN LISTS ARGN) | ||
# starts with a hyphen already? then just add it | ||
string (SUBSTRING ${deplib} 0 1 dash) | ||
if (${dash} STREQUAL "-") | ||
list (APPEND deplib_list ${deplib}) | ||
else (${dash} STREQUAL "-") | ||
# otherwise, parse the name into a directory and a name | ||
get_filename_component (deplib_dir ${deplib} PATH) | ||
get_filename_component (deplib_orig ${deplib} NAME) | ||
string (REGEX REPLACE | ||
"^${esc_dl_pref}(.*)${esc_dl_suff}$" | ||
"\\1" | ||
deplib_name | ||
${deplib_orig} | ||
) | ||
string (REGEX REPLACE | ||
"^${esc_ar_pref}(.*)${esc_ar_suff}$" | ||
"\\1" | ||
deplib_name | ||
${deplib_name} | ||
) | ||
# directory and name each on their own; this is somewhat | ||
# unsatisfactory because it may be that a system dir is specified | ||
# by an earlier directory and you start picking up libraries from | ||
# there instead of the "closest" path here. also, the soversion | ||
# is more or less lost. remove system default path, to lessen the | ||
# chance that we pick the wrong library | ||
if (NOT ((deplib_dir STREQUAL "/usr/lib") OR | ||
(deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}"))) | ||
list (APPEND deplib_list "-L${deplib_dir}") | ||
endif (NOT ((deplib_dir STREQUAL "/usr/lib") OR | ||
(deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}"))) | ||
# if there was no translation of the name, the library is named | ||
# unconventionally (.so.3gf, I'm looking at you), so pass this | ||
# name unmodified to the linker switch | ||
if (deplib_orig STREQUAL deplib_name) | ||
list (APPEND deplib_list "-l:${deplib_orig}") | ||
else (deplib_orig STREQUAL deplib_name) | ||
list (APPEND deplib_list "-l${deplib_name}") | ||
endif (deplib_orig STREQUAL deplib_name) | ||
endif (${dash} STREQUAL "-") | ||
endforeach (deplib) | ||
# caller determines whether we want it returned as a list or a string | ||
if ("${what}" STREQUAL "LIST") | ||
set (${outvar} ${deplib_list}) | ||
else ("${what}" STREQUAL "LIST") | ||
set (${outvar} "${deplib_list}") | ||
string (REPLACE ";" " " ${outvar} "${${outvar}}") | ||
endif ("${what}" STREQUAL "LIST") | ||
set (${outvar} "${${outvar}}" PARENT_SCOPE) | ||
endfunction (linker_cmdline what INTO outvar FROM) | ||
|
||
# convert a list back to a command-line string | ||
function (unseparate_args var_name prefix value) | ||
separate_arguments (value) | ||
foreach (item IN LISTS value) | ||
set (prefixed_item "${prefix}${item}") | ||
if (${var_name}) | ||
set (${var_name} "${${var_name}} ${prefixed_item}") | ||
else (${var_name}) | ||
set (${var_name} "${prefixed_item}") | ||
endif (${var_name}) | ||
endforeach (item) | ||
set (${var_name} "${${var_name}}" PARENT_SCOPE) | ||
endfunction (unseparate_args var_name prefix value) | ||
|
||
# wrapper to set variables in pkg-config file | ||
function (configure_pc_file name source dest prefix libdir includedir) | ||
# escape set of standard strings | ||
unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}") | ||
unseparate_args (defs "" "${${name}_DEFINITIONS}") | ||
linker_cmdline (STRING INTO libs FROM ${${name}_LIBRARIES}) | ||
|
||
# necessary to make these variables visible to configure_file | ||
set (name "${${name}_NAME}") | ||
set (description "${${name}_DESCRIPTION}") | ||
set (major "${${name}_VERSION_MAJOR}") | ||
set (minor "${${name}_VERSION_MINOR}") | ||
set (target "${name}") | ||
linker_cmdline (STRING INTO target from ${target}) | ||
|
||
configure_file (${source} ${dest} @ONLY) | ||
endfunction (configure_pc_file name source dist prefix libdir includedir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#FIXME: You can use https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html instead | ||
|
||
# - Multiarch support in object code library directories | ||
# | ||
# This module sets the following variable | ||
# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu | ||
# depending on the platform; use this path | ||
# for platform-specific binaries. | ||
# | ||
# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform; | ||
# use this path for architecture-independent | ||
# files. | ||
# | ||
# Note that it will override the results of GNUInstallDirs if included after | ||
# that module. | ||
|
||
# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu; | ||
# Fedora put module files in lib64/ too, but Debian uses lib/ for that | ||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND | ||
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") | ||
# Debian or Ubuntu? | ||
if (EXISTS "/etc/debian_version") | ||
set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}") | ||
set (_libdir_noarch "lib") | ||
elseif (EXISTS "/etc/fedora-release" OR | ||
EXISTS "/etc/redhat-release" OR | ||
EXISTS "/etc/slackware-version" OR | ||
EXISTS "/etc/gentoo-release") | ||
# 64-bit system? | ||
if (CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set (_libdir_noarch "lib64") | ||
else (CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set (_libdir_noarch "lib") | ||
endif (CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set (_libdir_def "${_libdir_noarch}") | ||
else () | ||
set (_libdir_def "lib") | ||
set (_libdir_noarch "lib") | ||
endif () | ||
else () | ||
set (_libdir_def "lib") | ||
set (_libdir_noarch "lib") | ||
endif () | ||
|
||
# let the user override if somewhere else is desirable | ||
set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries") | ||
set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files") | ||
mark_as_advanced ( | ||
CMAKE_INSTALL_LIBDIR | ||
CMAKE_INSTALL_LIBDIR_NOARCH | ||
) |