Commit ea7a5c45 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: merge in changes for RC 5

parent dff6df3a
......@@ -354,7 +354,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES)
SET(CMake_VERSION_MAJOR 2)
SET(CMake_VERSION_MINOR 6)
SET(CMake_VERSION_PATCH 2)
SET(CMake_VERSION_RC 4)
SET(CMake_VERSION_RC 5)
# CVS versions are odd, if this is an odd minor version
# then set the CMake_VERSION_DATE variable
IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$")
......
Changes in CMake 2.6.2 RC 5
- Add beta BundleUtilities.cmake file
- CPackRPM 7435 fixes to add optional post-install
- Fix Bug #7456, FindBoost versioned find not working
- Fix FindCurses to be able to work without ncurses.h
- FindQt4 fix bug #7433, add a bit more documentation and add ability
to specify extra flags to lupdate.
Changes in CMake 2.6.2 RC 4
- Fix bug #7359 make llvm-gcc work, by explicitely excluding
"llvm-" from _CMAKE_TOOLCHAIN_PREFIX
......
This diff is collapsed.
......@@ -68,11 +68,14 @@ IF(NOT CPACK_RPM_PACKAGE_VERSION)
ENDIF(NOT CPACK_RPM_PACKAGE_VERSION)
# CPACK_RPM_PACKAGE_ARCHITECTURE (optional)
IF(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
# FIXME This should be obtained through 'arch' command
# but is it --really necessary-- ?
SET(CPACK_RPM_PACKAGE_ARCHITECTURE i386)
ENDIF(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
IF(CPACK_RPM_PACKAGE_ARCHITECTURE)
SET(TMP_RPM_BUILDARCH "Buildarch: ${CPACK_RPM_PACKAGE_ARCHITECTURE}")
IF(CPACK_RPM_PACKAGE_DEBUG)
MESSAGE("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}")
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
ELSE(CPACK_RPM_PACKAGE_ARCHITECTURE)
SET(TMP_RPM_BUILDARCH "")
ENDIF(CPACK_RPM_PACKAGE_ARCHITECTURE)
# CPACK_RPM_PACKAGE_RELEASE
# The RPM release is the numbering of the RPM package ITSELF
......@@ -106,8 +109,7 @@ IF(NOT CPACK_RPM_PACKAGE_VENDOR)
ENDIF(NOT CPACK_RPM_PACKAGE_VENDOR)
# CPACK_RPM_PACKAGE_SOURCE
# The name of the source tarball in case we generate
# a source RPM
# The name of the source tarball in case we generate a source RPM
# CPACK_RPM_PACKAGE_DESCRIPTION
# The variable content may be either
......@@ -124,13 +126,29 @@ IF (NOT CPACK_RPM_PACKAGE_DESCRIPTION)
ENDIF (CPACK_PACKAGE_DESCRIPTION_FILE)
ENDIF (NOT CPACK_RPM_PACKAGE_DESCRIPTION)
# CPACK_RPM_SPEC_INSTALL_POST
# May be used to define a RPM post intallation script
# for example setting it to "/bin/true" may prevent
# rpmbuild from stripping binaries.
IF(CPACK_RPM_SPEC_INSTALL_POST)
SET(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}")
ENDIF(CPACK_RPM_SPEC_INSTALL_POST)
# CPACK_RPM_SPEC_MORE_DEFINE
# This is a generated spec rpm file spaceholder
IF(CPACK_RPM_SPEC_MORE_DEFINE)
IF(CPACK_RPM_PACKAGE_DEBUG)
MESSAGE("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}")
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
ENDIF(CPACK_RPM_SPEC_MORE_DEFINE)
# CPACK_RPM_USER_BINARY_SPECFILE
# FIXME when this is set then CPack should us the
# user provided file.
# Now we may create the RPM build tree structure
SET(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}")
MESSAGE(STATUS "CPackRPM:: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
MESSAGE(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
# Prepare RPM build tree
FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR})
FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp)
......@@ -157,15 +175,16 @@ IF(CPACK_RPM_USER_BINARY_SPECFILE)
ELSE(CPACK_RPM_USER_BINARY_SPECFILE)
# No User specified spec file generate a valid one using var values
IF(CPACK_RPM_PACKAGE_DEBUG)
MESSAGE("CPackRPM:: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
MESSAGE("CPackRPM:: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
MESSAGE("CPackRPM:: CPACK_TEMPORARY_DIRECTORY= ${PACK_TEMPORARY_DIRECTORY}")
MESSAGE("CPackRPM:: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
MESSAGE("CPackRPM:: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
MESSAGE("CPackRPM:: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
MESSAGE("CPackRPM:: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
MESSAGE("CPackRPM:: CPACK_PACKAGE_INSTALL_DIRECTORY = ${PACK_PACKAGE_INSTALL_DIRECTORY}")
MESSAGE("CPackRPM ::CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${PACK_TEMPORARY_DIRECTORY}")
MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${PACK_PACKAGE_INSTALL_DIRECTORY}")
MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
MESSAGE("CPackRPM:Debug: CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}")
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}
"# -*- rpm-spec -*-
......@@ -177,12 +196,15 @@ Release: ${CPACK_RPM_PACKAGE_RELEASE}
License: ${CPACK_RPM_PACKAGE_LICENSE}
Group: ${CPACK_RPM_PACKAGE_GROUP}
Vendor: ${CPACK_RPM_PACKAGE_VENDOR}
${TMP_RPM_BUILDARCH}
#%define prefix ${CMAKE_INSTALL_PREFIX}
%define _rpmdir ${CPACK_RPM_DIRECTORY}
%define _rpmfilename ${CPACK_RPM_FILE_NAME}
%define _unpackaged_files_terminate_build 0
%define _topdir ${CPACK_RPM_DIRECTORY}
${TMP_RPM_SPEC_INSTALL_POST}
${CPACK_RPM_SPEC_MORE_DEFINE}
%description
${CPACK_RPM_PACKAGE_DESCRIPTION}
......@@ -206,10 +228,11 @@ ${CPACK_RPM_PACKAGE_DESCRIPTION}
/*
%changelog
* Mon Aug 25 2008 Erk <eric.noulard@gmail.com>
Update generator to handle optional post-install
* Tue Aug 16 2007 Erk <eric.noulard@gmail.com>
Generated by CPack RPM Generator and associated macros
")
ENDIF(CPACK_RPM_USER_BINARY_SPECFILE)
......@@ -220,6 +243,11 @@ IF(RPMBUILD_EXECUTABLE)
WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err"
OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out")
IF(CPACK_RPM_PACKAGE_DEBUG)
MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ")
MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err")
MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out")
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
ELSE(RPMBUILD_EXECUTABLE)
IF(ALIEN_EXECUTABLE)
MESSAGE(FATAL_ERROR "RPM packaging through alien not done (yet)")
......
......@@ -286,8 +286,10 @@ ELSE (_boost_IN_CACHE)
# Try to find Boost by stepping backwards through the Boost versions
# we know about.
FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
IF( NOT Boost_INCLUDE_DIR )
IF( NOT Boost_INCLUDE_DIR )
# Build a list of path suffixes for each version.
SET(_boost_PATH_SUFFIXES)
FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
# Add in a path suffix, based on the required version, ideally
# we could read this from version.hpp, but for that to work we'd
# need to know the include dir already
......@@ -304,15 +306,16 @@ ELSE (_boost_IN_CACHE)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
_boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
ENDIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
FIND_PATH(Boost_INCLUDE_DIR
NAMES boost/config.hpp
HINTS ${_boost_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${_boost_PATH_SUFFIX}
LIST(APPEND _boost_PATH_SUFFIXES "${_boost_PATH_SUFFIX}")
ENDFOREACH(_boost_VER)
# Look for a standard boost header file.
FIND_PATH(Boost_INCLUDE_DIR
NAMES boost/config.hpp
HINTS ${_boost_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
)
ENDIF( NOT Boost_INCLUDE_DIR )
ENDFOREACH(_boost_VER)
ENDIF( NOT Boost_INCLUDE_DIR )
IF(Boost_INCLUDE_DIR)
# Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
......
......@@ -36,10 +36,12 @@ ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
# default search paths.
IF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
IF( CURSES_NCURSES_HAS_WSYNCUP)
SET(CURSES_USE_NCURSES TRUE)
ENDIF( CURSES_NCURSES_HAS_WSYNCUP)
......@@ -56,8 +58,10 @@ IF(NOT CURSES_USE_NCURSES)
# for compatibility with older FindCurses.cmake this has to be in the cache
# FORCE must not be used since this would break builds which preload a cache wqith these variables set
SET(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}" CACHE FILEPATH "The curses include path")
SET(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}" CACHE FILEPATH "The curses library")
SET(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}"
CACHE FILEPATH "The curses include path")
SET(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}"
CACHE FILEPATH "The curses library")
ELSE(NOT CURSES_USE_NCURSES)
# we need to find ncurses
GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
......@@ -66,15 +70,27 @@ ELSE(NOT CURSES_USE_NCURSES)
FIND_FILE(CURSES_HAVE_NCURSES_H ncurses.h)
FIND_FILE(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h)
FIND_FILE(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h)
FIND_FILE(CURSES_HAVE_CURSES_H curses.h HINTS "${_cursesParentDir}/include")
FIND_FILE(CURSES_HAVE_CURSES_H curses.h
HINTS "${_cursesParentDir}/include")
FIND_PATH(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h ncurses/curses.h)
FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h HINTS "${_cursesParentDir}/include")
FIND_PATH(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h
ncurses/curses.h)
FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h
HINTS "${_cursesParentDir}/include")
# for compatibility with older FindCurses.cmake this has to be in the cache
# FORCE must not be used since this would break builds which preload a cache wqith these variables set
SET(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}" CACHE FILEPATH "The curses include path")
SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" CACHE FILEPATH "The curses library")
# FORCE must not be used since this would break builds which preload
# a cache wqith these variables set
# only put ncurses include and library into
# variables if they are found
IF(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
SET(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}"
CACHE FILEPATH "The curses include path")
SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}"
CACHE FILEPATH "The curses library")
ENDIF(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
ENDIF(NOT CURSES_USE_NCURSES)
......@@ -86,9 +102,10 @@ FIND_LIBRARY(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
FIND_LIBRARY(CURSES_FORM_LIBRARY form )
# for compatibility with older FindCurses.cmake this has to be in the cache
# FORCE must not be used since this would break builds which preload a cache wqith these variables set
SET(FORM_LIBRARY "${CURSES_FORM_LIBRARY}" CACHE FILEPATH "The curses form library")
# FORCE must not be used since this would break builds which preload a cache
# qith these variables set
SET(FORM_LIBRARY "${CURSES_FORM_LIBRARY}"
CACHE FILEPATH "The curses form library")
# Need to provide the *_LIBRARIES
SET(CURSES_LIBRARIES ${CURSES_LIBRARY})
......@@ -107,7 +124,8 @@ SET(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG CURSES_LIBRARY CURSES_INCLUDE_PATH)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
CURSES_LIBRARY CURSES_INCLUDE_PATH)
MARK_AS_ADVANCED(
CURSES_INCLUDE_PATH
......
......@@ -103,9 +103,12 @@
# interface file is constructed from the basename of the header with
# the suffix .xml appended.
#
# macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ... ts_files ... )
# macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ...
# ts_files ... OPTIONS ...)
# out: qm_files
# in: directories sources ts_files
# options: flags to pass to lupdate, such as -extensions to specify
# extensions for a directory scan.
# generates commands to create .ts (vie lupdate) and .qm
# (via lrelease) - files from directories and/or sources. The ts files are
# created and/or updated in the source tree (unless given with full paths).
......@@ -1290,9 +1293,12 @@ IF (QT4_QMAKE_FOUND)
ENDMACRO(QT4_AUTOMOC)
MACRO(QT4_CREATE_TRANSLATION _qm_files)
QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN})
MESSAGE("lupdate_files ${_lupdate_files}")
MESSAGE("lupdate_options ${_lupdate_options}")
SET(_my_sources)
SET(_my_tsfiles)
FOREACH (_file ${ARGN})
FOREACH (_file ${_lupdate_files})
GET_FILENAME_COMPONENT(_ext ${_file} EXT)
GET_FILENAME_COMPONENT(_abs_FILE ${_file} ABSOLUTE)
IF(_ext MATCHES "ts")
......@@ -1304,7 +1310,7 @@ IF (QT4_QMAKE_FOUND)
FOREACH(_ts_file ${_my_tsfiles})
ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file}
COMMAND ${QT_LUPDATE_EXECUTABLE}
ARGS ${_my_sources} -ts ${_ts_file}
ARGS ${_lupdate_options} ${_my_sources} -ts ${_ts_file}
DEPENDS ${_my_sources})
ENDFOREACH(_ts_file)
QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles})
......
......@@ -12,13 +12,16 @@
# gp_append_unique
# gp_file_type
# is_file_executable
# gp_item_default_embedded_path
# (projects can override with gp_item_default_embedded_path_override)
# gp_resolve_item
# (projects can override with gp_resolve_item_override)
# get_prerequisites
# list_prerequisites
# list_prerequisites_by_glob
#
# Requires CMake 2.5 or greater because it uses function, break, return and
# Requires CMake 2.6 or greater because it uses function, break, return and
# PARENT_SCOPE.
#
cmake_minimum_required(VERSION 2.5 FATAL_ERROR)
# gp_append_unique list_var value
......@@ -135,7 +138,7 @@ function(is_file_executable file result_var)
endif("${file_full_lower}" MATCHES "\\.(exe|dll)$")
# A clause could be added here that uses output or return value of dumpbin
# to determine ${result_var}. In 95%+ practical cases, the exe|dll name
# to determine ${result_var}. In 99%+? practical cases, the exe|dll name
# match will be sufficient...
#
endif(WIN32)
......@@ -184,7 +187,171 @@ function(is_file_executable file result_var)
endfunction(is_file_executable)
# get_prerequisites target prerequisites_var exclude_system recurse
# gp_item_default_embedded_path item default_embedded_path_var
#
# Return the path that others should refer to the item by when the item
# is embedded inside a bundle.
#
# Override on a per-project basis by providing a project-specific
# gp_item_default_embedded_path_override function.
#
function(gp_item_default_embedded_path item default_embedded_path_var)
#
# The assumption here is that all executables in the bundle will be
# in same-level-directories inside the bundle. The parent directory
# of an executable inside the bundle should be MacOS or a sibling of
# MacOS and all embedded paths returned from here will begin with
# "@executable_path/../" and will work from all executables in all
# such same-level-directories inside the bundle.
#
# By default, embed things right next to the main bundle executable:
#
set(path "@executable_path/../../Contents/MacOS")
set(overridden 0)
# Embed .dylibs right next to the main bundle executable:
#
if(item MATCHES "\\.dylib$")
set(path "@executable_path/../MacOS")
set(overridden 1)
endif(item MATCHES "\\.dylib$")
# Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
#
if(NOT overridden)
if(item MATCHES "[^/]+\\.framework/")
set(path "@executable_path/../Frameworks")
set(overridden 1)
endif(item MATCHES "[^/]+\\.framework/")
endif(NOT overridden)
# Provide a hook so that projects can override the default embedded location of
# any given library by whatever logic they choose:
#
if(COMMAND gp_item_default_embedded_path_override)
gp_item_default_embedded_path_override("${item}" path)
endif(COMMAND gp_item_default_embedded_path_override)
set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
endfunction(gp_item_default_embedded_path)
# gp_resolve_item context item exepath dirs resolved_item_var
#
# Resolve an item into an existing full path file.
#
# Override on a per-project basis by providing a project-specific
# gp_resolve_item_override function.
#
function(gp_resolve_item context item exepath dirs resolved_item_var)
set(resolved 0)
set(resolved_item "${item}")
# Is it already resolved?
#
if(EXISTS "${resolved_item}")
set(resolved 1)
endif(EXISTS "${resolved_item}")
if(NOT resolved)
if(item MATCHES "@executable_path")
#
# @executable_path references are assumed relative to exepath
#
string(REPLACE "@executable_path" "${exepath}" ri "${item}")
get_filename_component(ri "${ri}" ABSOLUTE)
if(EXISTS "${ri}")
#message(STATUS "info: embedded item exists (${ri})")
set(resolved 1)
set(resolved_item "${ri}")
else(EXISTS "${ri}")
message(STATUS "info: embedded item does not exist '${ri}'")
endif(EXISTS "${ri}")
endif(item MATCHES "@executable_path")
endif(NOT resolved)
if(NOT resolved)
if(item MATCHES "@loader_path")
#
# @loader_path references are assumed relative to the
# PATH of the given "context" (presumably another library)
#
get_filename_component(contextpath "${context}" PATH)
string(REPLACE "@loader_path" "${contextpath}" ri "${item}")
get_filename_component(ri "${ri}" ABSOLUTE)
if(EXISTS "${ri}")
#message(STATUS "info: embedded item exists (${ri})")
set(resolved 1)
set(resolved_item "${ri}")
else(EXISTS "${ri}")
message(STATUS "info: embedded item does not exist '${ri}'")
endif(EXISTS "${ri}")
endif(item MATCHES "@loader_path")
endif(NOT resolved)
if(NOT resolved)
set(ri "ri-NOTFOUND")
find_file(ri "${item}" ${dirs})
if(ri)
#message(STATUS "info: found item in dirs (${ri})")
set(resolved 1)
set(resolved_item "${ri}")
set(ri "ri-NOTFOUND")
endif(ri)
endif(NOT resolved)
if(NOT resolved)
if(item MATCHES "[^/]+\\.framework/")
set(fw "fw-NOTFOUND")
find_file(fw "${item}"
"~/Library/Frameworks"
"/Library/Frameworks"
"/System/Library/Frameworks"
)
if(fw)
#message(STATUS "info: found framework (${fw})")
set(resolved 1)
set(resolved_item "${fw}")
set(fw "fw-NOTFOUND")
endif(fw)
endif(item MATCHES "[^/]+\\.framework/")
endif(NOT resolved)
# Using find_program on Windows will find dll files that are in the PATH.
# (Converting simple file names into full path names if found.)
#
if(WIN32)
if(NOT resolved)
set(ri "ri-NOTFOUND")
find_program(ri "${item}" PATHS "${dirs}")
if(ri)
set(resolved 1)
set(resolved_item "${ri}")
set(ri "ri-NOTFOUND")
endif(ri)
endif(NOT resolved)
endif(WIN32)
# Provide a hook so that projects can override item resolution
# by whatever logic they choose:
#
if(COMMAND gp_resolve_item_override)
gp_resolve_item_override("${context}" "${item}" "${exepath}" "${dirs}" resolved_item resolved)
endif(COMMAND gp_resolve_item_override)
if(NOT resolved)
message(STATUS "warning: cannot resolve item '${item}'")
endif(NOT resolved)
set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
endfunction(gp_resolve_item)
# get_prerequisites target prerequisites_var exclude_system recurse dirs
#
# Get the list of shared library files required by ${target}. The list in
# the variable named ${prerequisites_var} should be empty on first entry to
......@@ -201,20 +368,25 @@ endfunction(is_file_executable)
# recurse is 0 or 1: 0 for direct prerequisites only, 1 for all prerequisites
# recursively
#
# optional ARGV4 (verbose) is 0 or 1: 0 to skip informational message output,
# 1 to print it
# exepath is the path to the top level executable used for @executable_path
# replacment on the Mac
#
# dirs is a list of paths where libraries might be found: these paths are
# searched first when a target without any path info is given. Then standard
# system locations are also searched: PATH, Framework locations, /usr/lib...
#
function(get_prerequisites target prerequisites_var exclude_system recurse)
# set(verbose 0)
# if(NOT "${ARGV4}" STREQUAL "")
# message(STATUS "ARGV4='${ARGV4}'")
# set(verbose "${ARGV4}")
# endif(NOT "${ARGV4}" STREQUAL "")
# message(STATUS "verbose='${verbose}'")
function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
set(verbose 0)
set(eol_char "E")
if(NOT IS_ABSOLUTE "${target}")
message("warning: target '${target}' is not absolute...")
endif(NOT IS_ABSOLUTE "${target}")
if(NOT EXISTS "${target}")
message("warning: target '${target}' does not exist...")
endif(NOT EXISTS "${target}")
# <setup-gp_tool-vars>
#
# Try to choose the right tool by default. Caller can set gp_tool prior to
......@@ -288,7 +460,10 @@ function(get_prerequisites target prerequisites_var exclude_system recurse)
get_filename_component(gp_cmd_dir "${gp_cmd}" PATH)
get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE)
if(EXISTS "${gp_cmd_dlls_dir}")
set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
# only add to the path if it is not already in the path
if(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
endif(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
endif(EXISTS "${gp_cmd_dlls_dir}")
endif("${gp_tool}" STREQUAL "dumpbin")
#
......@@ -340,19 +515,11 @@ function(get_prerequisites target prerequisites_var exclude_system recurse)
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
endif(gp_regex_cmp_count GREATER 2)
# Using find_program on Windows will find dll files that are in the PATH.
# (Converting simple file names into full path names if found.)
# Use the raw_item as the list entries returned by this function. Use the
# gp_resolve_item function to resolve it to an actual full path file if
# necessary.
#
set(item "item-NOTFOUND")
find_program(item "${raw_item}" PATHS "${target_dir}")
if(NOT item)
set(item "${raw_item}")
endif(NOT item)
if(verbose)
message(STATUS "raw_item='${raw_item}'")
message(STATUS "item='${item}'")
endif(verbose)
set(item "${raw_item}")
# Add each item unless it is excluded:
#
......@@ -377,8 +544,12 @@ function(get_prerequisites target prerequisites_var exclude_system recurse)
# Add it to unseen_prereqs so that we can recursively add *its*
# prerequisites...
#
# But first: resolve its name to an absolute full path name such
# that the analysis tools can simply accept it as input.
#
if(NOT list_length_before_append EQUAL list_length_after_append)
set(unseen_prereqs ${unseen_prereqs} "${item}")
gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item)
set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
endif(NOT list_length_before_append EQUAL list_length_after_append)
endif(${recurse})
endif(add_item)
......@@ -394,7 +565,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse)
if(${recurse})
set(more_inputs ${unseen_prereqs})
foreach(input ${more_inputs})
get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse})
get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
endforeach(input)
endif(${recurse})
......@@ -441,8 +612,10 @@ function(list_prerequisites target)
set(print_target "${verbose}")
set(type_str "")
get_filename_component(exepath "${target}" PATH)
set(prereqs "")
get_prerequisites("${target}" prereqs ${exclude_system} ${all})
get_prerequisites("${target}" prereqs ${exclude_system} ${all} "${exepath}" "")
if(print_target)
message(STATUS "File '${target}' depends on:")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment