diff options
103 files changed, 1382 insertions, 347 deletions
diff --git a/Docs/bash-completion/cmake b/Docs/bash-completion/cmake index 59b565a..5f33c09 100644 --- a/Docs/bash-completion/cmake +++ b/Docs/bash-completion/cmake @@ -100,11 +100,13 @@ _cmake() return ;; -G) - # FIXME: doesn't work properly local IFS=$'\n' + local quoted + printf -v quoted %q "$cur" COMPREPLY=( $( compgen -W '$( cmake --help 2>/dev/null | sed -n \ - "/^.*[^ ].*= Generates/{s|^ *\(.*[^ ]\) *= Generates.*$|\1|;s| |\\\\ |g;p}" \ - 2>/dev/null )' -- "$cur" ) ) + -e "1,/^Generators/d" \ + -e "/^ *[^ =]/{s|^ *\([^=]*[^ =]\).*$|\1|;s| |\\\\ |g;p}" \ + 2>/dev/null )' -- "$quoted" ) ) return ;; --help-command) diff --git a/Docs/bash-completion/cpack b/Docs/bash-completion/cpack index a0c1f83..51638c5 100644 --- a/Docs/bash-completion/cpack +++ b/Docs/bash-completion/cpack @@ -8,8 +8,8 @@ _cpack() case "$prev" in -G) COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null | - grep "^ .*= .*" 2> /dev/null | grep -v "^ -" 2>/dev/null | - cut -d" " -f 3 )' -- "$cur" ) ) + sed -e "1,/^Generators/d" -e "s|^ *\([^ ]*\) .*$|\1|" \ + 2>/dev/null )' -- "$cur" ) ) return ;; -C) diff --git a/Docs/bash-completion/ctest b/Docs/bash-completion/ctest index 9707f62..7433d3d 100644 --- a/Docs/bash-completion/ctest +++ b/Docs/bash-completion/ctest @@ -54,7 +54,7 @@ _ctest() return ;; -S|--script|-SP|--script-new-process) - # FIXME ? + _filedir '@(cmake|ctest)' return ;; --interactive-debug-mode) diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake new file mode 100644 index 0000000..e4af54c --- /dev/null +++ b/Modules/CMakeGraphVizOptions.cmake @@ -0,0 +1,83 @@ +##section Variables specific to the graphviz support +##end +##module +# - The builtin graphviz support of CMake. +# CMake can generate graphviz files, showing the dependencies between +# the targets in a project and also external libraries which are linked +# against. +# When CMake is run with the --graphiz=foo option, it will produce +# * a foo.dot file showing all dependencies in the project +# * a foo.dot.<target> file for each target, file showing on which other targets the respective target depends +# * a foo.dot.<target>.dependers file, showing which other targets depend on the respective target +# +# This can result in huge graphs. Using the file CMakeGraphVizOptions.cmake +# the look and content of the generated graphs can be influenced. +# This file is searched first in ${CMAKE_BINARY_DIR} and then in +# ${CMAKE_SOURCE_DIR}. If found, it is read and the variables set in it +# are used to adjust options for the generated graphviz files. +##end +# +##variable +# GRAPHVIZ_GRAPH_TYPE - The graph type +# Mandatory : NO +# Default : "digraph" +##end +##variable +# GRAPHVIZ_GRAPH_NAME - The graph name. +# Mandatory : NO +# Default : "GG" +##end +##variable +# GRAPHVIZ_GRAPH_HEADER - The header written at the top of the graphviz file. +# Mandatory : NO +# Default : "node [n fontsize = "12"];" +##end +##variable +# GRAPHVIZ_NODE_PREFIX - The prefix for each node in the graphviz file. +# Mandatory : NO +# Default : "node" +##end +##variable +# GRAPHVIZ_EXECUTABLES - Set this to FALSE to exclude executables from the generated graphs. +# Mandatory : NO +# Default : TRUE +##end +##variable +# GRAPHVIZ_STATIC_LIBS - Set this to FALSE to exclude static libraries from the generated graphs. +# Mandatory : NO +# Default : TRUE +##end +##variable +# GRAPHVIZ_SHARED_LIBS - Set this to FALSE to exclude shared libraries from the generated graphs. +# Mandatory : NO +# Default : TRUE +##end +##variable +# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude static libraries from the generated graphs. +# Mandatory : NO +# Default : TRUE +##end +##variable +# GRAPHVIZ_EXTERNAL_LIBS - Set this to FALSE to exclude external libraries from the generated graphs. +# Mandatory : NO +# Default : TRUE +##end +##variable +# GRAPHVIZ_IGNORE_TARGETS - A list of regular expressions for ignoring targets. +# Mandatory : NO +# Default : empty +##end + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2013 Alexander Neundorf <neundorf@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake new file mode 100644 index 0000000..ef5d857 --- /dev/null +++ b/Modules/CMakePrintHelpers.cmake @@ -0,0 +1,146 @@ +# - Convenience macros for printing properties and variables, useful e.g. for debugging. +# +# +# CMAKE_PRINT_PROPERTIES([TARGETS target1 .. targetN] +# [SOURCES source1 .. sourceN] +# [DIRECTORIES dir1 .. dirN] +# [TESTS test1 .. testN] +# [CACHE_ENTRIES entry1 .. entryN] +# PROPERTIES prop1 .. propN ) +# +# This macro prints the values of the properties of the given targets, +# source files, directories, tests or cache entries. Exactly one of the +# scope keywords must be used. +# Example: +# cmake_print_properties(TARGETS foo bar PROPERTIES LOCATION INTERFACE_INCLUDE_DIRS) +# This will print the LOCATION and INTERFACE_INCLUDE_DIRS properties for both +# targets foo and bar. +# +# +# CMAKE_PRINT_VARIABLES(var1 var2 .. varN) +# +# This macro will print the name of each variable followed by its value. +# Example: +# cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION THIS_ONE_DOES_NOT_EXIST) +# Gives: +# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; THIS_ONE_DOES_NOT_EXIST="" + +#============================================================================= +# Copyright 2013 Alexander Neundorf, <neundorf@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CMakeParseArguments) + +function(CMAKE_PRINT_VARIABLES) + set(msg "") + foreach(var ${ARGN}) + if(msg) + set(msg "${msg} ; ") + endif() + set(msg "${msg}${var}=\"${${var}}\"") + endforeach() + message(STATUS "${msg}") +endfunction() + + +function(CMAKE_PRINT_PROPERTIES ) + set(options ) + set(oneValueArgs ) + set(multiValueArgs TARGETS SOURCES TESTS DIRECTORIES CACHE_ENTRIES PROPERTIES ) + + cmake_parse_arguments(CPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CPP_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to cmake_print_properties(): \"${CPP_UNPARSED_ARGUMENTS}\"") + return() + endif() + + if(NOT CPP_PROPERTIES) + message(FATAL_ERROR "Required argument PROPERTIES missing in cmake_print_properties() call") + return() + endif() + + set(mode) + set(items) + set(keyword) + + if(CPP_TARGETS) + set(items ${CPP_TARGETS}) + set(mode ${mode} TARGETS) + set(keyword TARGET) + endif() + + if(CPP_SOURCES) + set(items ${CPP_SOURCES}) + set(mode ${mode} SOURCES) + set(keyword SOURCE) + endif() + + if(CPP_TESTS) + set(items ${CPP_TESTS}) + set(mode ${mode} TESTS) + set(keyword TEST) + endif() + + if(CPP_DIRECTORIES) + set(items ${CPP_DIRECTORIES}) + set(mode ${mode} DIRECTORIES) + set(keyword DIRECTORY) + endif() + + if(CPP_CACHE_ENTRIES) + set(items ${CPP_CACHE_ENTRIES}) + set(mode ${mode} CACHE_ENTRIES) + set(keyword CACHE) + endif() + + if(NOT mode) + message(FATAL_ERROR "Mode keyword missing in cmake_print_properties() call, must be one of TARGETS SOURCES TESTS DIRECTORIES CACHE_ENTRIES PROPERTIES") + return() + endif() + + list(LENGTH mode modeLength) + if("${modeLength}" GREATER 1) + message(FATAL_ERROR "Multiple mode keyword used in cmake_print_properties() call, it must be exactly one of TARGETS SOURCES TESTS DIRECTORIES CACHE_ENTRIES PROPERTIES") + return() + endif() + + set(msg "\n") + foreach(item ${items}) + + set(itemExists TRUE) + if(keyword STREQUAL "TARGET") + if(NOT TARGET ${item}) + set(itemExists FALSE) + set(msg "${msg}\n No such TARGET \"${item}\" !\n\n") + endif() + endif() + + if (itemExists) + set(msg "${msg} Properties for ${keyword} ${item}:\n") + foreach(prop ${CPP_PROPERTIES}) + + get_property(propertySet ${keyword} ${item} PROPERTY "${prop}" SET) + + if(propertySet) + get_property(property ${keyword} ${item} PROPERTY "${prop}") + set(msg "${msg} ${item}.${prop} = \"${property}\"\n") + else() + set(msg "${msg} ${item}.${prop} = <NOTFOUND>\n") + endif() + endforeach() + endif() + + endforeach() + message(STATUS "${msg}") + +endfunction() diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake index 08809bf..b37b706 100644 --- a/Modules/CMakePushCheckState.cmake +++ b/Modules/CMakePushCheckState.cmake @@ -1,8 +1,10 @@ -# This module defines two macros: +# This module defines three macros: # CMAKE_PUSH_CHECK_STATE() -# and # CMAKE_POP_CHECK_STATE() -# These two macros can be used to save and restore the state of the variables +# and +# CMAKE_RESET_CHECK_STATE() +# These macros can be used to save, restore and reset (i.e., clear contents) +# the state of the variables # CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS, CMAKE_REQUIRED_LIBRARIES # and CMAKE_REQUIRED_INCLUDES used by the various Check-files coming with CMake, # like e.g. check_function_exists() etc. @@ -11,9 +13,16 @@ # but after the Find-module has been executed they should have the same value # as they had before. # +# CMAKE_PUSH_CHECK_STATE() macro receives optional argument RESET. Whether it's specified, +# CMAKE_PUSH_CHECK_STATE() will set all CMAKE_REQUIRED_* variables to empty values, same +# as CMAKE_RESET_CHECK_STATE() call will do. +# # Usage: -# cmake_push_check_state() -# set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF) +# cmake_push_check_state(RESET) +# set(CMAKE_REQUIRED_DEFINITIONS -DSOME_MORE_DEF) +# check_function_exists(...) +# cmake_reset_check_state() +# set(CMAKE_REQUIRED_DEFINITIONS -DANOTHER_DEF) # check_function_exists(...) # cmake_pop_check_state() @@ -31,6 +40,15 @@ # License text for the above reference.) +macro(CMAKE_RESET_CHECK_STATE) + + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_DEFINITIONS) + set(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_FLAGS) + +endmacro() + macro(CMAKE_PUSH_CHECK_STATE) if(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER) @@ -43,6 +61,11 @@ macro(CMAKE_PUSH_CHECK_STATE) set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) + + if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET") + cmake_reset_check_state() + endif() + endmacro() macro(CMAKE_POP_CHECK_STATE) diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 02f7cb6..2213acc 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -2,9 +2,10 @@ # CHECK_C_COMPILER_FLAG(<flag> <var>) # <flag> - the compiler flag # <var> - variable to store the result -# This internally calls the check_c_source_compiles macro. +# This internally calls the check_c_source_compiles macro and +# sets CMAKE_REQUIRED_DEFINITIONS to <flag>. # See help for CheckCSourceCompiles for a listing of variables -# that can modify the build. +# that can otherwise modify the build. #============================================================================= # Copyright 2006-2011 Kitware, Inc. diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index a872a75..5e8db03 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -2,9 +2,10 @@ # CHECK_CXX_COMPILER_FLAG(<flag> <var>) # <flag> - the compiler flag # <var> - variable to store the result -# This internally calls the check_cxx_source_compiles macro. See help -# for CheckCXXSourceCompiles for a listing of variables that can -# modify the build. +# This internally calls the check_cxx_source_compiles macro and +# sets CMAKE_REQUIRED_DEFINITIONS to <flag>. +# See help for CheckCXXSourceCompiles for a listing of variables +# that can otherwise modify the build. #============================================================================= # Copyright 2006-2010 Kitware, Inc. diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 5a680e3..0390ae4 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -607,7 +607,11 @@ macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext ) NO_DEFAULT_PATH ) # Search default search paths, after we search our own set of paths. - find_library(${_var} NAMES ${_names} DOC ${_doc}) + find_library(${_var} + NAMES ${_names} + PATHS "/usr/lib/nvidia-current" + DOC ${_doc} + ) endmacro() macro(cuda_find_library_local_first _var _names _doc) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index de17f16..4f522e5 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -28,7 +28,6 @@ # Optional variables you can define prior to calling this module: # # GTK2_DEBUG - Enables verbose debugging of the module -# GTK2_SKIP_MARK_AS_ADVANCED - Disable marking cache variables as advanced # GTK2_ADDITIONAL_SUFFIXES - Allows defining additional directories to # search for include files # @@ -67,6 +66,17 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Version 1.5 (UNRELEASED) (CMake 2.8.12) +# * 14236: Detect gthread library +# Detect pangocairo on windows +# Detect pangocairo with gtk module instead of with gtkmm +# * 14259: Use vc100 libraries with MSVC11 +# * 14260: Export a GTK2_DEFINITIONS variable to set /vd2 when appropriate +# (i.e. MSVC) +# * Use the optimized/debug syntax for _LIBRARY and _LIBRARIES variables when +# appropriate. A new set of _RELEASE variables was also added. +# * Remove GTK2_SKIP_MARK_AS_ADVANCED option, as now the variables are +# marked as advanced by SelectLibraryConfigurations # Version 1.4 (10/4/2012) (CMake 2.8.10) # * 12596: Missing paths for FindGTK2 on NetBSD # * 12049: Fixed detection of GTK include files in the lib folder on @@ -117,6 +127,9 @@ # _OUT_micro = Micro version number # _gtkversion_hdr = Header file to parse #============================================================= + +include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr) file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+") if(_contents) @@ -145,7 +158,7 @@ endfunction() #============================================================= # _GTK2_FIND_INCLUDE_DIR # Internal function to find the GTK include directories -# _var = variable to set +# _var = variable to set (_INCLUDE_DIR is appended) # _hdr = header file to look for #============================================================= function(_GTK2_FIND_INCLUDE_DIR _var _hdr) @@ -201,7 +214,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) message(STATUS "Adding ${_gtk2_arch_dir} to search path for multiarch support") endif() endif() - find_path(${_var} ${_hdr} + find_path(${_var}_INCLUDE_DIR ${_hdr} PATHS ${_gtk2_arch_dir} /usr/local/lib64 @@ -228,11 +241,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) ${_suffixes} ) - if(${_var}) - set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}} PARENT_SCOPE) - if(NOT GTK2_SKIP_MARK_AS_ADVANCED) - mark_as_advanced(${_var}) - endif() + if(${_var}_INCLUDE_DIR) + set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}_INCLUDE_DIR} PARENT_SCOPE) endif() endfunction() @@ -240,7 +250,7 @@ endfunction() #============================================================= # _GTK2_FIND_LIBRARY # Internal function to find libraries packaged with GTK2 -# _var = library variable to create +# _var = library variable to create (_LIBRARY is appended) #============================================================= function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) @@ -322,10 +332,10 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) if(GTK2_DEBUG) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "While searching for ${_var}, our proposed library list is ${_lib_list}") + "While searching for ${_var}_LIBRARY, our proposed library list is ${_lib_list}") endif() - find_library(${_var} + find_library(${_var}_LIBRARY_RELEASE NAMES ${_lib_list} PATHS /opt/gnome/lib @@ -339,34 +349,34 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) if(_expand_vc AND MSVC) if(GTK2_DEBUG) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "While searching for ${_var}_DEBUG our proposed library list is ${_libd_list}") + "While searching for ${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}") endif() - find_library(${_var}_DEBUG + find_library(${_var}_LIBRARY_DEBUG NAMES ${_libd_list} PATHS $ENV{GTKMM_BASEPATH}/lib [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib ) + endif() - if(${_var} AND ${_var}_DEBUG) - if(NOT GTK2_SKIP_MARK_AS_ADVANCED) - mark_as_advanced(${_var}_DEBUG) - endif() - set(GTK2_LIBRARIES ${GTK2_LIBRARIES} optimized ${${_var}} debug ${${_var}_DEBUG}) - set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE) - endif() - else() - if(NOT GTK2_SKIP_MARK_AS_ADVANCED) - mark_as_advanced(${_var}) - endif() - set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}}) - set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE) - # Set debug to release - set(${_var}_DEBUG ${${_var}}) - set(${_var}_DEBUG ${${_var}} PARENT_SCOPE) + select_library_configurations(${_var}) + + set(${_var}_LIBRARY ${${_var}_LIBRARY} PARENT_SCOPE) + + set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}_LIBRARY}) + set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE) + + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "${_var}_LIBRARY_RELEASE = \"${${_var}_LIBRARY_RELEASE}\"") + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "${_var}_LIBRARY_DEBUG = \"${${_var}_LIBRARY_DEBUG}\"") + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "${_var}_LIBRARY = \"${${_var}_LIBRARY}\"") endif() + endfunction() #============================================================= @@ -395,7 +405,7 @@ if(GTK2_FIND_VERSION) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " "Searching for version ${GTK2_FIND_VERSION}") endif() - _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h) if(GTK2_GTK_INCLUDE_DIR) _GTK2_GET_VERSION(GTK2_MAJOR_VERSION GTK2_MINOR_VERSION @@ -445,90 +455,89 @@ list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES}) foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") - _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h) if(UNIX) - _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-x11 false true) - _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-x11 false true) + _GTK2_FIND_LIBRARY (GTK2_GTK gtk-x11 false true) + _GTK2_FIND_LIBRARY (GTK2_GDK gdk-x11 false true) else() - _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-win32 false true) - _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-win32 false true) + _GTK2_FIND_LIBRARY (GTK2_GTK gtk-win32 false true) + _GTK2_FIND_LIBRARY (GTK2_GDK gdk-win32 false true) endif() - _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDK gdk/gdk.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG gdkconfig.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO_INCLUDE_DIR cairo.h) - _GTK2_FIND_LIBRARY (GTK2_CAIRO_LIBRARY cairo false false) + _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO cairo.h) + _GTK2_FIND_LIBRARY (GTK2_CAIRO cairo false false) - _GTK2_FIND_INCLUDE_DIR(GTK2_FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_FONTCONFIG fontconfig/fontconfig.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h) - _GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO pango/pango.h) + _GTK2_FIND_LIBRARY (GTK2_PANGO pango false true) - _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO_LIBRARY pangocairo false true) + _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO pangocairo false true) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h) - _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF_LIBRARY gdk_pixbuf false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) + _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF gdk_pixbuf false true) - _GTK2_FIND_LIBRARY (GTK2_GTHREAD_LIBRARY gthread false true) + _GTK2_FIND_LIBRARY (GTK2_GTHREAD gthread false true) - _GTK2_FIND_LIBRARY (GTK2_GIO_LIBRARY gio false true) + _GTK2_FIND_LIBRARY (GTK2_GIO gio false true) - _GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h) - _GTK2_FIND_LIBRARY (GTK2_ATK_LIBRARY atk false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_ATK atk/atk.h) + _GTK2_FIND_LIBRARY (GTK2_ATK atk false true) - _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT_INCLUDE_DIR gobject/gobject.h) - _GTK2_FIND_LIBRARY (GTK2_GOBJECT_LIBRARY gobject false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT gobject/gobject.h) + _GTK2_FIND_LIBRARY (GTK2_GOBJECT gobject false true) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB_INCLUDE_DIR glib.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG_INCLUDE_DIR glibconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GLIB_LIBRARY glib false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB glib.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG glibconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GLIB glib false true) elseif(_GTK2_component STREQUAL "gtkmm") - _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM_INCLUDE_DIR gtkmm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG_INCLUDE_DIR gtkmmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GTKMM_LIBRARY gtkmm true true) - - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM_INCLUDE_DIR gdkmm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG_INCLUDE_DIR gdkmmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GDKMM_LIBRARY gdkmm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM gtkmm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG gtkmmconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GTKMM gtkmm true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM_INCLUDE_DIR pangomm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG_INCLUDE_DIR pangommconfig.h) - _GTK2_FIND_LIBRARY (GTK2_PANGOMM_LIBRARY pangomm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM gdkmm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG gdkmmconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GDKMM gdkmm true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG_INCLUDE_DIR cairommconfig.h) - _GTK2_FIND_LIBRARY (GTK2_CAIROMM_LIBRARY cairomm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM pangomm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG pangommconfig.h) + _GTK2_FIND_LIBRARY (GTK2_PANGOMM pangomm true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM_INCLUDE_DIR giomm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG_INCLUDE_DIR giommconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GIOMM_LIBRARY giomm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM cairomm/cairomm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG cairommconfig.h) + _GTK2_FIND_LIBRARY (GTK2_CAIROMM cairomm true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM_INCLUDE_DIR atkmm.h) - _GTK2_FIND_LIBRARY (GTK2_ATKMM_LIBRARY atkmm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM giomm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG giommconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GIOMM giomm true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM_INCLUDE_DIR glibmm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG_INCLUDE_DIR glibmmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GLIBMM_LIBRARY glibmm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM atkmm.h) + _GTK2_FIND_LIBRARY (GTK2_ATKMM atkmm true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++_INCLUDE_DIR sigc++/sigc++.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG_INCLUDE_DIR sigc++config.h) - _GTK2_FIND_LIBRARY (GTK2_SIGC++_LIBRARY sigc true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM glibmm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG glibmmconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GLIBMM glibmm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++ sigc++/sigc++.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG sigc++config.h) + _GTK2_FIND_LIBRARY (GTK2_SIGC++ sigc true true) elseif(_GTK2_component STREQUAL "glade") - _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE_INCLUDE_DIR glade/glade.h) - _GTK2_FIND_LIBRARY (GTK2_GLADE_LIBRARY glade false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE glade/glade.h) + _GTK2_FIND_LIBRARY (GTK2_GLADE glade false true) elseif(_GTK2_component STREQUAL "glademm") - _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM_INCLUDE_DIR libglademm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG_INCLUDE_DIR libglademmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GLADEMM_LIBRARY glademm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM libglademm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG libglademmconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GLADEMM glademm true true) else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index fef4669..33c2971 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -39,10 +39,37 @@ if(ZLIB_FOUND) ) list(APPEND PNG_NAMES png libpng) - foreach(v 16 15 14 12) - list(APPEND PNG_NAMES png${v} libpng${v} png${v}d libpng${v}d) + unset(PNG_NAMES_DEBUG) + set(_PNG_VERSION_SUFFIXES 17 16 15 14 12) + if (PNG_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\..*)?$") + string(REGEX REPLACE + "^([0-9]+)\\.([0-9]+).*" "\\1\\2" + _PNG_VERSION_SUFFIX_MIN "${PNG_FIND_VERSION}") + if (PNG_FIND_VERSION_EXACT) + set(_PNG_VERSION_SUFFIXES ${_PNG_VERSION_SUFFIX_MIN}) + else () + string(REGEX REPLACE + "${_PNG_VERSION_SUFFIX_MIN}.*" "${_PNG_VERSION_SUFFIX_MIN}" + _PNG_VERSION_SUFFIXES "${_PNG_VERSION_SUFFIXES}") + endif () + unset(_PNG_VERSION_SUFFIX_MIN) + endif () + foreach(v IN LISTS _PNG_VERSION_SUFFIXES) + list(APPEND PNG_NAMES png${v} libpng${v}) + list(APPEND PNG_NAMES_DEBUG png${v}d libpng${v}d) endforeach() - find_library(PNG_LIBRARY NAMES ${PNG_NAMES} ) +message(STATUS "PNG r: ${PNG_NAMES} d: ${PNG_NAMES_DEBUG}") + unset(_PNG_VERSION_SUFFIXES) + find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES}) + find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG}) + unset(PNG_NAMES) + unset(PNG_NAMES_DEBUG) + + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(PNG) + # Set by select_library_configurations(), but we want the one from + # find_package_handle_standard_args() below. + unset(PNG_FOUND) if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) # png.h includes zlib.h. Sigh. diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 7b37e1e..1d17ba3 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -886,20 +886,16 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) endforeach() if(Q_WS_WIN) - if (QT_QAXCONTAINER_FOUND) - set(QT_MODULES ${QT_MODULES} QAxContainer) - # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR - find_path(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt - PATHS ${QT_HEADERS_DIR}/ActiveQt - NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH - ) - endif() - if (QT_QAXSERVER_FOUND) - find_path(QT_QAXSERVER_INCLUDE_DIR ActiveQt - PATHS ${QT_HEADERS_DIR}/ActiveQt - NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH - ) - endif() + set(QT_MODULES ${QT_MODULES} QAxContainer QAxServer) + # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR + find_path(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt + PATHS ${QT_HEADERS_DIR}/ActiveQt + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH + ) + find_path(QT_QAXSERVER_INCLUDE_DIR ActiveQt + PATHS ${QT_HEADERS_DIR}/ActiveQt + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH + ) endif() # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR @@ -1016,6 +1012,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) macro(_qt4_add_target_depends _QT_MODULE) get_target_property(_configs Qt4::${_QT_MODULE} IMPORTED_CONFIGURATIONS) + _qt4_add_target_depends_internal(${_QT_MODULE} INTERFACE_LINK_LIBRARIES ${ARGN}) foreach(_config ${_configs}) _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN}) endforeach() @@ -1060,8 +1057,8 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) if(Q_WS_WIN) _QT4_ADJUST_LIB_VARS(qtmain) + _QT4_ADJUST_LIB_VARS(QAxServer) if(QT_QAXSERVER_FOUND) - _QT4_ADJUST_LIB_VARS(QAxServer) set_property(TARGET Qt4::QAxServer PROPERTY INTERFACE_QT4_NO_LINK_QTMAIN ON ) @@ -1069,9 +1066,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) COMPATIBLE_INTERFACE_BOOL QT4_NO_LINK_QTMAIN) endif() - if(QT_QAXCONTAINER_FOUND) - _QT4_ADJUST_LIB_VARS(QAxContainer) - endif() + _QT4_ADJUST_LIB_VARS(QAxContainer) endif() # Only public dependencies are listed here. @@ -1122,6 +1117,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) set(_isNotExcluded $<NOT:$<BOOL:$<TARGET_PROPERTY:QT4_NO_LINK_QTMAIN>>>) set(_isPolicyNEW $<TARGET_POLICY:CMP0020>) get_target_property(_configs Qt4::QtCore IMPORTED_CONFIGURATIONS) + set_property(TARGET Qt4::QtCore APPEND PROPERTY + INTERFACE_LINK_LIBRARIES + $<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt4::qtmain> + ) foreach(_config ${_configs}) set_property(TARGET Qt4::QtCore APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 5e13b59..f1aedd7 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -113,19 +113,16 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) set (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") - set(targetincludes) - set(targetdefines) if(moc_target) - list(APPEND targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>") - list(APPEND targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>") + set(targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>") + set(targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>") set(targetincludes "$<$<BOOL:${targetincludes}>:-I$<JOIN:${targetincludes},\n-I>\n>") set(targetdefines "$<$<BOOL:${targetdefines}>:-D$<JOIN:${targetdefines},\n-D>\n>") file (GENERATE OUTPUT ${_moc_parameters_file} - CONTENT "${targetdefines}${targetincludes}${targetoptions}${_moc_parameters}\n" - CONDITION 1 + CONTENT "${targetdefines}${targetincludes}${_moc_parameters}\n" ) set(targetincludes) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d0a651c..f63178e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 11) -set(CMake_VERSION_TWEAK 20130723) +set(CMake_VERSION_TWEAK 20130731) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 0508448..7a3edb5 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1302,10 +1302,9 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec) for ( it = vec.begin(); it != vec.end(); ++it ) { int retVal = 0; - std::string cmd = cmSystemTools::ConvertToOutputPath(it->c_str()); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << cmd + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it << std::endl); - if ( !cmSystemTools::RunSingleCommand(cmd.c_str(), 0, &retVal, 0, + if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0, cmSystemTools::OUTPUT_MERGE /*this->Verbose*/) || retVal != 0 ) { diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h index 4504795..e9bbf28 100644 --- a/Source/cmAddCompileOptionsCommand.h +++ b/Source/cmAddCompileOptionsCommand.h @@ -62,7 +62,6 @@ public: "Arguments to add_compile_options may use \"generator " "expressions\" with the syntax \"$<...>\". " CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS ; } diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h index 841061c..46cd77e 100644 --- a/Source/cmDocumentGeneratorExpressions.h +++ b/Source/cmDocumentGeneratorExpressions.h @@ -95,12 +95,4 @@ "the target on which the generator expression is evaluated.\n" \ "" -#define CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS \ - "Language related expressions:\n" \ - " $<LINK_LANGUAGE> = The link language of the target " \ - "being generated.\n" \ - " $<LINK_LANGUAGE:lang> = '1' if the link language of the " \ - "target being generated matches lang, else '0'.\n" \ - "" - #endif diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index fcaa169..58b7147 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -963,9 +963,11 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Enables tracing output for target properties.", "This variable can be populated with a list of properties to generate " "debug output for when evaluating target properties. Currently it can " - "only be used when evaluating the INCLUDE_DIRECTORIES target property. " - "In that case, it outputs a backtrace for each include directory in " - "the build. Default is unset.",false,"Variables That Change Behavior"); + "only be used when evaluating the INCLUDE_DIRECTORIES, " + "COMPILE_DEFINITIONS and COMPILE_OPTIONS target properties. " + "In that case, it outputs a backtrace for each entry in the target " + "propertythe build. Default is unset.", + false,"Variables That Change Behavior"); // Variables defined by CMake that describe the system @@ -1518,6 +1520,22 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "See that target property for additional information.", false, "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_<LANG>_VISIBILITY_PRESET", cmProperty::VARIABLE, + "Default value for <LANG>_VISIBILITY_PRESET of targets.", + "This variable is used to initialize the " + "<LANG>_VISIBILITY_PRESET property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_VISIBILITY_INLINES_HIDDEN", cmProperty::VARIABLE, + "Default value for VISIBILITY_INLINES_HIDDEN of targets.", + "This variable is used to initialize the " + "VISIBILITY_INLINES_HIDDEN property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); // Variables defined when the a language is enabled These variables will // also be defined whenever CMake has loaded its support for compiling (LANG) @@ -1622,6 +1640,12 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables for Languages"); cm->DefineProperty + ("CMAKE_<LANG>_FLAGS", cmProperty::VARIABLE, + "Flags for all build types.", + "<LANG> flags used regardless of the value of CMAKE_BUILD_TYPE.",false, + "Variables for Languages"); + + cm->DefineProperty ("CMAKE_<LANG>_FLAGS_DEBUG", cmProperty::VARIABLE, "Flags for Debug build type or configuration.", "<LANG> flags used when CMAKE_BUILD_TYPE is Debug.",false, @@ -1862,8 +1886,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE", cmProperty::VARIABLE,0,0); - cm->DefineProperty("CMAKE_<LANG>_FLAGS", - cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_FLAGS_DEBUG_INIT", cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_FLAGS_INIT", diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 90e6d51..5b351bc 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -277,28 +277,33 @@ static bool checkInterfaceDirs(const std::string &prepro, //---------------------------------------------------------------------------- void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( - cmTarget *target, + cmTargetExport *tei, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, std::vector<std::string> &missingTargets) { + cmTarget *target = tei->Target; assert(preprocessRule == cmGeneratorExpression::InstallInterface); const char *propName = "INTERFACE_INCLUDE_DIRECTORIES"; const char *input = target->GetProperty(propName); - if (!input) + if (!input && tei->InterfaceIncludeDirectories.empty()) { return; } - if (!*input) + if ((input && !*input) && tei->InterfaceIncludeDirectories.empty()) { // Set to empty properties[propName] = ""; return; } - std::string prepro = cmGeneratorExpression::Preprocess(input, - preprocessRule); + std::string includes = (input?input:""); + const char* sep = input ? ";" : ""; + includes += sep + tei->InterfaceIncludeDirectories; + std::string prepro = cmGeneratorExpression::Preprocess(includes, + preprocessRule, + true); if (!prepro.empty()) { this->ResolveTargetsInGeneratorExpressions(prepro, target, @@ -349,6 +354,16 @@ void getCompatibleInterfaceProperties(cmTarget *target, { cmComputeLinkInformation *info = target->GetLinkInformation(config); + if (!info) + { + cmMakefile* mf = target->GetMakefile(); + cmOStringStream e; + e << "Exporting the target \"" << target->GetName() << "\" is not " + "allowed since its linker language cannot be determined"; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; + } + const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); for(cmComputeLinkInformation::ItemVector::const_iterator li = @@ -626,7 +641,7 @@ cmExportFileGenerator cmMakefile *mf = target->GetMakefile(); cmOStringStream e; e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, " - "but also has old-style INTERFACE_LINK_LIBRARIES properties " + "but also has old-style LINK_INTERFACE_LIBRARIES properties " "populated, but it was exported without the " "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties"; mf->IssueMessage(cmake::FATAL_ERROR, e.str()); diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index a624ba6..9628b96 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -15,6 +15,8 @@ #include "cmCommand.h" #include "cmGeneratorExpression.h" +class cmTargetExport; + /** \class cmExportFileGenerator * \brief Generate a file exporting targets from a build or install tree. * @@ -114,7 +116,7 @@ protected: void GenerateInterfaceProperties(cmTarget *target, std::ostream& os, const ImportPropertyMap &properties); void PopulateIncludeDirectoriesInterface( - cmTarget *target, + cmTargetExport *target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, std::vector<std::string> &missingTargets); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ce7afc5..c97d4ff 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -39,7 +39,7 @@ std::string cmExportInstallFileGenerator::GetConfigImportFileGlob() //---------------------------------------------------------------------------- bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { - std::vector<cmTarget*> allTargets; + std::vector<cmTargetExport*> allTargets; { std::string expectedTargets; std::string sep; @@ -49,10 +49,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName(); sep = " "; - cmTargetExport const* te = *tei; + cmTargetExport * te = *tei; if(this->ExportedTargets.insert(te->Target).second) { - allTargets.push_back(te->Target); + allTargets.push_back(te); } else { @@ -115,16 +115,16 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) bool require2_8_12 = false; // Create all the imported targets. - for(std::vector<cmTarget*>::const_iterator + for(std::vector<cmTargetExport*>::const_iterator tei = allTargets.begin(); tei != allTargets.end(); ++tei) { - cmTarget* te = *tei; + cmTarget* te = (*tei)->Target; this->GenerateImportTargetCode(os, te); ImportPropertyMap properties; - this->PopulateIncludeDirectoriesInterface(te, + this->PopulateIncludeDirectoriesInterface(*tei, cmGeneratorExpression::InstallInterface, properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 586fee2..aa755d1 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -90,7 +90,7 @@ public: " file(TIMESTAMP filename variable [<format string>] [UTC])\n" " file(GENERATE OUTPUT output_file\n" " <INPUT input_file|CONTENT input_content>\n" - " CONDITION expression)\n" + " [CONDITION expression])\n" "WRITE will write a message into a file called 'filename'. It " "overwrites the file if it already exists, and creates the file " "if it does not exist. (If the file is a build input, use " diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index ab8bd13..e962313 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -229,8 +229,27 @@ static std::string stripAllGeneratorExpressions(const std::string &input) } //---------------------------------------------------------------------------- +static void prefixItems(const std::string &content, std::string &result, + const std::string &prefix) +{ + std::vector<std::string> entries; + cmGeneratorExpression::Split(content, entries); + for(std::vector<std::string>::const_iterator ei = entries.begin(); + ei != entries.end(); ++ei) + { + if (!cmSystemTools::FileIsFullPath(ei->c_str()) + && cmGeneratorExpression::Find(*ei) == std::string::npos) + { + result += prefix; + } + result += *ei; + } +} + +//---------------------------------------------------------------------------- static std::string stripExportInterface(const std::string &input, - cmGeneratorExpression::PreprocessContext context) + cmGeneratorExpression::PreprocessContext context, + bool resolveRelative) { std::string result; @@ -289,7 +308,15 @@ static std::string stripExportInterface(const std::string &input, else if(context == cmGeneratorExpression::InstallInterface && gotInstallInterface) { - result += input.substr(pos, c - cStart); + const std::string content = input.substr(pos, c - cStart); + if (resolveRelative) + { + prefixItems(content, result, "${_IMPORT_PREFIX}/"); + } + else + { + result += content; + } } break; } @@ -380,7 +407,8 @@ void cmGeneratorExpression::Split(const std::string &input, //---------------------------------------------------------------------------- std::string cmGeneratorExpression::Preprocess(const std::string &input, - PreprocessContext context) + PreprocessContext context, + bool resolveRelative) { if (context == StripAllGeneratorExpressions) { @@ -388,7 +416,7 @@ std::string cmGeneratorExpression::Preprocess(const std::string &input, } else if (context == BuildInterface || context == InstallInterface) { - return stripExportInterface(input, context); + return stripExportInterface(input, context, resolveRelative); } assert(!"cmGeneratorExpression::Preprocess called with invalid args"); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 86b6f25..c20f130 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -57,7 +57,8 @@ public: }; static std::string Preprocess(const std::string &input, - PreprocessContext context); + PreprocessContext context, + bool resolveRelative = false); static void Split(const std::string &input, std::vector<std::string> &output); diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 381ef7c..d0b6190 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -564,77 +564,30 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode const char* loc = 0; const char* imp = 0; std::string suffix; - return context->CurrentTarget->GetMappedConfig(context->Config, + if (context->CurrentTarget->GetMappedConfig(context->Config, &loc, &imp, - suffix) ? "1" : "0"; - } - return "0"; - } -} configurationTestNode; - -//---------------------------------------------------------------------------- -static const struct LinkLanguageNode : public cmGeneratorExpressionNode -{ - LinkLanguageNode() {} - - virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; } - - std::string Evaluate(const std::vector<std::string> ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (dagChecker && dagChecker->EvaluatingLinkLibraries()) - { - reportError(context, content->GetOriginalExpression(), - "$<LINK_LANGUAGE> expression can not be used while evaluating " - "link libraries"); - return std::string(); - } - if (parameters.size() != 0 && parameters.size() != 1) - { - reportError(context, content->GetOriginalExpression(), - "$<LINK_LANGUAGE> expression requires one or two parameters"); - return std::string(); - } - cmTarget* target = context->HeadTarget; - if (!target) - { - reportError(context, content->GetOriginalExpression(), - "$<LINK_LANGUAGE> may only be used with targets. It may not " - "be used with add_custom_command."); - return std::string(); - } - - const char *lang = target->GetLinkerLanguage(context->Config); - if (parameters.size() == 0) - { - return lang ? lang : ""; - } - else - { - cmsys::RegularExpression langValidator; - langValidator.compile("^[A-Za-z0-9_]*$"); - if (!langValidator.find(parameters.begin()->c_str())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!lang) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), lang) == 0) + suffix)) { - return "1"; + // This imported target has an appropriate location + // for this (possibly mapped) config. + // Check if there is a proper config mapping for the tested config. + std::vector<std::string> mappedConfigs; + std::string mapProp = "MAP_IMPORTED_CONFIG_"; + mapProp += context->Config; + if(const char* mapValue = + context->CurrentTarget->GetProperty(mapProp.c_str())) + { + cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), + mappedConfigs); + return std::find(mappedConfigs.begin(), mappedConfigs.end(), + context->Config) != mappedConfigs.end() ? "1" : "0"; + } } - return "0"; } + return "0"; } -} linkLanguageNode; +} configurationTestNode; static const struct JoinNode : public cmGeneratorExpressionNode { @@ -835,6 +788,20 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode assert(target); + if (propertyName == "LINKER_LANGUAGE") + { + if (target->LinkLanguagePropagatesToDependents() && + dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries()) + { + reportError(context, content->GetOriginalExpression(), + "LINKER_LANGUAGE target property can not be used while evaluating " + "link libraries for a static library"); + return std::string(); + } + const char *lang = target->GetLinkerLanguage(context->Config); + return lang ? lang : ""; + } + cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, target->GetName(), propertyName, @@ -1380,8 +1347,6 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) return &configurationNode; else if (identifier == "CONFIG") return &configurationTestNode; - else if (identifier == "LINK_LANGUAGE") - return &linkLanguageNode; else if (identifier == "TARGET_FILE") return &targetFileNode; else if (identifier == "TARGET_LINKER_FILE") diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 245883c..61d0272 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -147,7 +147,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, //we need to track every dependency that comes in, since we are trying //to find dependencies that are side effects of build commands // - this->CombinedBuildExplicitDependencies.insert(*i); + this->CombinedBuildExplicitDependencies.insert( EncodePath(*i) ); } // Write implicit dependencies. @@ -180,7 +180,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, i != outputs.end(); ++i) { build << " " << EncodeIdent(EncodePath(*i), os); - this->CombinedBuildOutputs.insert(*i); + this->CombinedBuildOutputs.insert( EncodePath(*i) ); } build << ":"; @@ -950,7 +950,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) typedef std::vector<std::string>::const_iterator vect_it; for(vect_it j = files.begin(); j != files.end(); ++j) { - knownDependencies.insert(ng->ConvertToNinjaPath( j->c_str() )); + knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) ); } } @@ -965,26 +965,15 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) typedef std::vector<std::string>::const_iterator vect_it; for(vect_it j = files.begin(); j != files.end(); ++j) { - knownDependencies.insert(ng->ConvertToNinjaPath( j->c_str() )); + knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) ); } } - //insert outputs from all WirteBuild commands - for(std::set<std::string>::iterator i = this->CombinedBuildOutputs.begin(); - i != this->CombinedBuildOutputs.end(); ++i) - { - knownDependencies.insert(*i); - } - - //after we have combined the data into knownDependencies we have no need - //to keep this data around - this->CombinedBuildOutputs.clear(); - for(TargetAliasMap::const_iterator i= this->TargetAliases.begin(); i != this->TargetAliases.end(); ++i) { - knownDependencies.insert(i->first); + knownDependencies.insert( ng->ConvertToNinjaPath(i->first.c_str()) ); } //remove all source files we know will exist. @@ -993,11 +982,26 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) i != this->AssumedSourceDependencies.end(); ++i) { - knownDependencies.insert(i->first); + knownDependencies.insert( ng->ConvertToNinjaPath(i->first.c_str()) ); } + //insert outputs from all WirteBuild commands + for(std::set<std::string>::iterator i = this->CombinedBuildOutputs.begin(); + i != this->CombinedBuildOutputs.end(); ++i) + { + //these paths have already be encoded when added to CombinedBuildOutputs + knownDependencies.insert(*i); + } + + //after we have combined the data into knownDependencies we have no need + //to keep this data around + this->CombinedBuildOutputs.clear(); + //now we difference with CombinedBuildExplicitDependencies to find - //the list of items we know nothing about + //the list of items we know nothing about. + //We have encoded all the paths in CombinedBuildExplicitDependencies + //and knownDependencies so no matter if unix or windows paths they + //should all match now. std::vector<std::string> unkownExplicitDepends; this->CombinedBuildExplicitDependencies.erase("all"); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index d3a8037..0faf1d4 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -219,6 +219,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmCAStringVector runtimeArgVector (&argHelper,"RUNTIME",&group); cmCAStringVector frameworkArgVector (&argHelper,"FRAMEWORK",&group); cmCAStringVector bundleArgVector (&argHelper,"BUNDLE",&group); + cmCAStringVector includesArgVector (&argHelper,"INCLUDES",&group); cmCAStringVector privateHeaderArgVector(&argHelper,"PRIVATE_HEADER",&group); cmCAStringVector publicHeaderArgVector (&argHelper,"PUBLIC_HEADER",&group); cmCAStringVector resourceArgVector (&argHelper,"RESOURCE",&group); @@ -247,6 +248,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmInstallCommandArguments privateHeaderArgs(this->DefaultComponentName); cmInstallCommandArguments publicHeaderArgs(this->DefaultComponentName); cmInstallCommandArguments resourceArgs(this->DefaultComponentName); + cmInstallCommandIncludesArgument includesArgs; // now parse the args for specific parts of the target (e.g. LIBRARY, // RUNTIME, ARCHIVE etc. @@ -258,6 +260,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) privateHeaderArgs.Parse(&privateHeaderArgVector.GetVector(), &unknownArgs); publicHeaderArgs.Parse (&publicHeaderArgVector.GetVector(), &unknownArgs); resourceArgs.Parse (&resourceArgVector.GetVector(), &unknownArgs); + includesArgs.Parse (&includesArgVector.GetVector(), &unknownArgs); if(!unknownArgs.empty()) { @@ -747,6 +750,20 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) te->RuntimeGenerator = runtimeGenerator; this->Makefile->GetLocalGenerator()->GetGlobalGenerator() ->GetExportSets()[exports.GetString()]->AddTargetExport(te); + + std::vector<std::string> dirs = includesArgs.GetIncludeDirs(); + if(!dirs.empty()) + { + std::string dirString; + const char *sep = ""; + for (std::vector<std::string>::const_iterator it = dirs.begin(); + it != dirs.end(); ++it) + { + te->InterfaceIncludeDirectories += sep; + te->InterfaceIncludeDirectories += *it; + sep = ";"; + } + } } } diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 39acd23..6509501 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -102,6 +102,7 @@ public: " [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|\n" " PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE]\n" " [DESTINATION <dir>]\n" + " [INCLUDES DESTINATION [<dir> ...]]\n" " [PERMISSIONS permissions...]\n" " [CONFIGURATIONS [Debug|Release|...]]\n" " [COMPONENT <component>]\n" @@ -130,6 +131,10 @@ public: "all target types. If only one is given then only targets of that " "type will be installed (which can be used to install just a DLL or " "just an import library)." + "The INCLUDES DESTINATION specifies a list of directories which will " + "be added to the INTERFACE_INCLUDE_DIRECTORIES of the <targets> when " + "exported by install(EXPORT). If a relative path is specified, it is " + "treated as relative to the $<INSTALL_PREFIX>." "\n" "The PRIVATE_HEADER, PUBLIC_HEADER, and RESOURCE arguments cause " "subsequent properties to be applied to installing a FRAMEWORK " diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 8e48f08..91ea861 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -203,3 +203,37 @@ bool cmInstallCommandArguments::CheckPermissions( // This is not a valid permission. return false; } + +cmInstallCommandIncludesArgument::cmInstallCommandIncludesArgument() +{ + +} + +const std::vector<std::string>& +cmInstallCommandIncludesArgument::GetIncludeDirs() const +{ + return this->IncludeDirs; +} + +void cmInstallCommandIncludesArgument::Parse( + const std::vector<std::string>* args, + std::vector<std::string>*) +{ + if(args->empty()) + { + return; + } + std::vector<std::string>::const_iterator it = args->begin(); + ++it; + for ( ; it != args->end(); ++it) + { + std::string dir = *it; + if (!cmSystemTools::FileIsFullPath(it->c_str()) + && cmGeneratorExpression::Find(*it) == std::string::npos) + { + dir = "$<INSTALL_PREFIX>/" + dir; + } + cmSystemTools::ConvertToUnixSlashes(dir); + this->IncludeDirs.push_back(dir); + } +} diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 01f7d56..90347e6 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -65,4 +65,17 @@ class cmInstallCommandArguments bool CheckPermissions(); }; +class cmInstallCommandIncludesArgument +{ + public: + cmInstallCommandIncludesArgument(); + void Parse(const std::vector<std::string>* args, + std::vector<std::string>* unconsumedArgs); + + const std::vector<std::string>& GetIncludeDirs() const; + + private: + std::vector<std::string> IncludeDirs; +}; + #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4e871d6..b187d6b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1380,7 +1380,7 @@ void cmLocalGenerator::AddCompileOptions( // COMPILE_FLAGS are not escaped for historical reasons. this->AppendFlags(flags, targetFlags); } - std::vector<std::string> opts; // TODO: Emitted. + std::vector<std::string> opts; target->GetCompileOptions(opts, config); for(std::vector<std::string>::const_iterator i = opts.begin(); i != opts.end(); ++i) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 818a580..78012de 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4081,14 +4081,13 @@ void cmMakefile::DefineProperties(cmake *cm) "List of options to pass to the compiler.", "This property specifies the list of directories given " "so far for this property. " - "This property exists on directories and targets. " + "This property exists on directories and targets." "\n" "The target property values are used by the generators to set " "the options for the compiler.\n" "Contents of COMPILE_OPTIONS may use \"generator expressions\" with " "the syntax \"$<...>\". " - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS); + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); cm->DefineProperty ("LINK_DIRECTORIES", cmProperty::DIRECTORY, diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 70c28d4..0ba673e 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -575,6 +575,32 @@ cmPolicies::cmPolicies() "property for in-build targets, and ignore the old properties matching " "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?.", 2,8,11,20130516, cmPolicies::WARN); + + this->DefinePolicy( + CMP0023, "CMP0023", + "Plain and keyword target_link_libraries signatures cannot be mixed.", + "CMake 2.8.12 introduced the target_link_libraries signature using " + "the PUBLIC, PRIVATE, and INTERFACE keywords to generalize the " + "LINK_PUBLIC and LINK_PRIVATE keywords introduced in CMake 2.8.7. " + "Use of signatures with any of these keywords sets the link interface " + "of a target explicitly, even if empty. " + "This produces confusing behavior when used in combination with the " + "historical behavior of the plain target_link_libraries signature. " + "For example, consider the code:\n" + " target_link_libraries(mylib A)\n" + " target_link_libraries(mylib PRIVATE B)\n" + "After the first line the link interface has not been set explicitly " + "so CMake would use the link implementation, A, as the link interface. " + "However, the second line sets the link interface to empty. " + "In order to avoid this subtle behavior CMake now prefers to disallow " + "mixing the plain and keyword signatures of target_link_libraries for " + "a single target." + "\n" + "The OLD behavior for this policy is to allow keyword and plain " + "target_link_libraries signatures to be mixed. " + "The NEW behavior for this policy is to not to allow mixing of the " + "keyword and plain signatures.", + 2,8,11,20130724, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 20c953f..5b843a9 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -73,6 +73,7 @@ public: CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES /// target property CMP0022, ///< INTERFACE_LINK_LIBRARIES defines the link interface + CMP0023, ///< Disallow mixing keyword and plain tll signatures /** \brief Always the last entry. * diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index cc10840..b5e5225 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -84,12 +84,14 @@ bool cmSetPropertyCommand { doing = DoingNone; this->AppendMode = true; + this->Remove = false; this->AppendAsString = false; } else if(*arg == "APPEND_STRING") { doing = DoingNone; this->AppendMode = true; + this->Remove = false; this->AppendAsString = true; } else if(doing == DoingNames) @@ -160,7 +162,7 @@ bool cmSetPropertyCommand::HandleGlobalMode() } if(this->AppendMode) { - cm->AppendProperty(name, value, this->AppendAsString); + cm->AppendProperty(name, value ? value : "", this->AppendAsString); } else { @@ -226,7 +228,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() } if(this->AppendMode) { - mf->AppendProperty(name, value, this->AppendAsString); + mf->AppendProperty(name, value ? value : "", this->AppendAsString); } else { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c52c266..9ec4938 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -638,6 +638,12 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command, cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); } + if (outputflag == OUTPUT_PASSTHROUGH) + { + cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1); + cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1); + } + cmsysProcess_SetTimeout(cp, timeout); cmsysProcess_Execute(cp); @@ -645,7 +651,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command, char* data; int length; int pipe; - if ( output || outputflag != OUTPUT_NONE ) + if(outputflag != OUTPUT_PASSTHROUGH && (output || outputflag != OUTPUT_NONE)) { while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0) { @@ -2464,7 +2470,15 @@ bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath, cmds.push_back(fullPath.c_str()); std::string output; - RunSingleCommand(cmds, &output, 0, 0, OUTPUT_NONE); + if(!RunSingleCommand(cmds, &output, 0, 0, OUTPUT_NONE)) + { + cmds.insert(cmds.begin(), "-r"); + cmds.insert(cmds.begin(), "xcrun"); + if(!RunSingleCommand(cmds, &output, 0, 0, OUTPUT_NONE)) + { + return false; + } + } std::vector<std::string> strs = cmSystemTools::tokenize(output, "\n"); // otool returns extra lines reporting multiple install names diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 9614449..9d7dae9 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -211,7 +211,7 @@ public: * user-viewable output from the program being run will be generated. * OUTPUT_MERGE is the legacy behaviour where stdout and stderr are merged * into stdout. OUTPUT_NORMAL passes through the output to stdout/stderr as - * it was received. + * it was received. OUTPUT_PASSTHROUGH passes through the original handles. * * If timeout is specified, the command will be terminated after * timeout expires. Timeout is specified in seconds. @@ -230,7 +230,8 @@ public: { OUTPUT_NONE = 0, OUTPUT_MERGE, - OUTPUT_NORMAL + OUTPUT_NORMAL, + OUTPUT_PASSTHROUGH }; static bool RunSingleCommand(const char* command, std::string* output = 0, int* retVal = 0, const char* dir = 0, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 70500cd..560f07c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -292,7 +292,6 @@ void cmTarget::DefineProperties(cmake *cm) "Contents of COMPILE_DEFINITIONS may use \"generator expressions\" with " "the syntax \"$<...>\". " CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER); cm->DefineProperty @@ -305,14 +304,13 @@ void cmTarget::DefineProperties(cmake *cm) "List of options to pass to the compiler.", "This property specifies the list of options specified " "so far for this property. " - "This property exists on directories and targets. " + "This property exists on directories and targets." "\n" "The target property values are used by the generators to set " "the options for the compiler.\n" "Contents of COMPILE_OPTIONS may use \"generator expressions\" with " "the syntax \"$<...>\". " - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS); + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); cm->DefineProperty ("INTERFACE_COMPILE_OPTIONS", cmProperty::TARGET, @@ -323,8 +321,7 @@ void cmTarget::DefineProperties(cmake *cm) "as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_OPTIONS> to use the " "compile options specified in the interface of 'foo'." "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS); + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); cm->DefineProperty ("DEFINE_SYMBOL", cmProperty::TARGET, @@ -653,8 +650,7 @@ void cmTarget::DefineProperties(cmake *cm) "See also the include_directories command.\n" "Contents of INCLUDE_DIRECTORIES may use \"generator expressions\" with " "the syntax \"$<...>\". " - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS); + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); cm->DefineProperty ("INSTALL_NAME_DIR", cmProperty::TARGET, @@ -749,7 +745,11 @@ void cmTarget::DefineProperties(cmake *cm) "file providing the program entry point (main). " "If not set, the language with the highest linker preference " "value is the default. " - "See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables."); + "See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables." + "\n" + "If this property is not set by the user, it will be calculated at " + "generate-time by CMake." + ); cm->DefineProperty ("LOCATION", cmProperty::TARGET, @@ -870,19 +870,17 @@ void cmTarget::DefineProperties(cmake *cm) "as $<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES> to use the " "include directories specified in the interface of 'foo'." "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS); + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); cm->DefineProperty - ("SYSTEM_INTERFACE_INCLUDE_DIRECTORIES", cmProperty::TARGET, + ("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", cmProperty::TARGET, "List of public system include directories for a library.", "Targets may populate this property to publish the include directories " "which contain system headers, and therefore should not result in " "compiler warnings. Consuming targets will then mark the same include " "directories as system headers." "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS); + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); cm->DefineProperty ("INTERFACE_COMPILE_DEFINITIONS", cmProperty::TARGET, @@ -893,8 +891,7 @@ void cmTarget::DefineProperties(cmake *cm) "as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_DEFINITIONS> to use the " "compile definitions specified in the interface of 'foo'." "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS); + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); cm->DefineProperty ("LINK_INTERFACE_MULTIPLICITY", cmProperty::TARGET, @@ -1004,22 +1001,13 @@ void cmTarget::DefineProperties(cmake *cm) "(such as \"lib\") on a library name."); cm->DefineProperty - ("C_VISIBILITY_PRESET", cmProperty::TARGET, - "Value for symbol visibility compile flags", - "The C_VISIBILITY_PRESET property determines the value passed used in " - "a visibility related compile option, such as -fvisibility=. This " - "property only has an affect for libraries and executables with " - "exports. This property is initialized by the value of the variable " - "CMAKE_C_VISIBILITY_PRESET if it is set when a target is created."); - - cm->DefineProperty - ("CXX_VISIBILITY_PRESET", cmProperty::TARGET, + ("<LANG>_VISIBILITY_PRESET", cmProperty::TARGET, "Value for symbol visibility compile flags", - "The CXX_VISIBILITY_PRESET property determines the value passed used in " - "a visibility related compile option, such as -fvisibility=. This " - "property only has an affect for libraries and executables with " + "The <LANG>_VISIBILITY_PRESET property determines the value passed in " + "a visibility related compile option, such as -fvisibility= for <LANG>. " + "This property only has an affect for libraries and executables with " "exports. This property is initialized by the value of the variable " - "CMAKE_CXX_VISIBILITY_PRESET if it is set when a target is created."); + "CMAKE_<LANG>_VISIBILITY_PRESET if it is set when a target is created."); cm->DefineProperty ("VISIBILITY_INLINES_HIDDEN", cmProperty::TARGET, @@ -2497,6 +2485,63 @@ static std::string targetNameGenex(const char *lib) } //---------------------------------------------------------------------------- +bool cmTarget::PushTLLCommandTrace(TLLSignature signature) +{ + bool ret = true; + if (!this->TLLCommands.empty()) + { + if (this->TLLCommands.back().first != signature) + { + ret = false; + } + } + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + this->TLLCommands.push_back(std::make_pair(signature, lfbt)); + return ret; +} + +//---------------------------------------------------------------------------- +void cmTarget::GetTllSignatureTraces(cmOStringStream &s, + TLLSignature sig) const +{ + std::vector<cmListFileBacktrace> sigs; + typedef std::vector<std::pair<TLLSignature, cmListFileBacktrace> > Container; + for(Container::const_iterator it = this->TLLCommands.begin(); + it != this->TLLCommands.end(); ++it) + { + if (it->first == sig) + { + sigs.push_back(it->second); + } + } + if (!sigs.empty()) + { + const char *sigString + = (sig == cmTarget::KeywordTLLSignature ? "keyword" + : "plain"); + s << "The uses of the " << sigString << " signature are here:\n"; + std::set<cmStdString> emitted; + for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin(); + it != sigs.end(); ++it) + { + cmListFileBacktrace::const_iterator i = it->begin(); + if(i != it->end()) + { + cmListFileContext const& lfc = *i; + cmOStringStream line; + line << " * " << (lfc.Line? "": " in ") << lfc << std::endl; + if (emitted.insert(line.str()).second) + { + s << line.str(); + } + ++i; + } + } + } +} + +//---------------------------------------------------------------------------- void cmTarget::AddLinkLibrary(cmMakefile& mf, const char *target, const char* lib, LinkLibraryType llt) @@ -3206,7 +3251,7 @@ static void processIncludeDirectories(cmTarget *tgt, { e << "Target \"" << (*it)->TargetName << "\" contains relative " "path in its INTERFACE_INCLUDE_DIRECTORIES:\n" - " \"" << *li << "\" "; + " \"" << *li << "\""; } else { @@ -3344,6 +3389,34 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) new cmTargetInternals::TargetPropertyEntry(cge, it->Value)); } + + if(this->Makefile->IsOn("APPLE")) + { + LinkImplementation const* impl = this->GetLinkImplementation(config, + this); + for(std::vector<std::string>::const_iterator + it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) + { + std::string libDir = cmSystemTools::CollapseFullPath(it->c_str()); + + static cmsys::RegularExpression + frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); + if(!frameworkCheck.find(libDir)) + { + continue; + } + + libDir = frameworkCheck.match(1); + + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(libDir.c_str()); + this->Internal + ->CachedLinkInterfaceIncludeDirectoriesEntries[configString] + .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + } + } } processIncludeDirectories(this, @@ -6168,7 +6241,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } // Get the link languages. - if(this->GetType() == cmTarget::STATIC_LIBRARY) + if(this->LinkLanguagePropagatesToDependents()) { std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES"; linkProp += suffix; @@ -6394,6 +6467,15 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, break; } } + else + { + iface.Libraries = impl->Libraries; + if(this->LinkLanguagePropagatesToDependents()) + { + // Targets using this archive need its language runtime libraries. + iface.Languages = impl->Languages; + } + } } } @@ -6422,7 +6504,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, headTarget, this, &dagChecker), iface.Libraries); - if(this->GetType() == cmTarget::SHARED_LIBRARY) + if(this->GetType() == cmTarget::SHARED_LIBRARY + || this->GetType() == cmTarget::STATIC_LIBRARY) { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. @@ -6456,6 +6539,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, } } } + if(this->LinkLanguagePropagatesToDependents()) + { + // Targets using this archive need its language runtime libraries. + iface.Languages = impl->Languages; + } } } else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN @@ -6470,7 +6558,7 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, iface.ImplementationIsInterface = true; iface.Libraries = impl->Libraries; iface.WrongConfigLibraries = impl->WrongConfigLibraries; - if(this->GetType() == cmTarget::STATIC_LIBRARY) + if(this->LinkLanguagePropagatesToDependents()) { // Targets using this archive need its language runtime libraries. iface.Languages = impl->Languages; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0da0f12..27b74ca 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -190,6 +190,12 @@ public: void AddLinkLibrary(cmMakefile& mf, const char *target, const char* lib, LinkLibraryType llt); + enum TLLSignature { + KeywordTLLSignature, + PlainTLLSignature + }; + bool PushTLLCommandTrace(TLLSignature signature); + void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const; void MergeLinkLibraries( cmMakefile& mf, const char* selfname, const LinkLibraryVectorType& libs ); @@ -543,11 +549,16 @@ public: void FinalizeSystemIncludeDirectories(); + bool LinkLanguagePropagatesToDependents() const + { return this->TargetTypeValue == STATIC_LIBRARY; } + private: // The set of include directories that are marked as system include // directories. std::set<cmStdString> SystemIncludeDirectories; + std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands; + /** * A list of direct dependencies. Use in conjunction with DependencyMap. */ diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index bc58b31..585485d 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -70,7 +70,6 @@ public: "Arguments to target_compile_definitions may use \"generator " "expressions\" with the syntax \"$<...>\". " CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS ; } diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h index c9d87fb..7665888 100644 --- a/Source/cmTargetExport.h +++ b/Source/cmTargetExport.h @@ -12,6 +12,8 @@ #ifndef cmTargetExport_h #define cmTargetExport_h +#include "cmStandardIncludes.h" + class cmTarget; class cmInstallTargetGenerator; class cmInstallFilesGenerator; @@ -33,6 +35,7 @@ public: cmInstallTargetGenerator* FrameworkGenerator; cmInstallTargetGenerator* BundleGenerator; cmInstallFilesGenerator* HeaderGenerator; + std::string InterfaceIncludeDirectories; ///@} }; diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 2968618..fcc37f0 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -83,7 +83,6 @@ public: "Arguments to target_include_directories may use \"generator " "expressions\" with the syntax \"$<...>\". " CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS ; } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index c5f490e..0ee9420 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -116,7 +116,7 @@ bool cmTargetLinkLibrariesCommand { if(args[i] == "LINK_INTERFACE_LIBRARIES") { - this->CurrentProcessingState = ProcessingLinkInterface; + this->CurrentProcessingState = ProcessingPlainLinkInterface; if(i != 1) { this->Makefile->IssueMessage( @@ -127,9 +127,26 @@ bool cmTargetLinkLibrariesCommand return true; } } + else if(args[i] == "INTERFACE") + { + if(i != 1 + && this->CurrentProcessingState != ProcessingKeywordPrivateInterface + && this->CurrentProcessingState != ProcessingKeywordPublicInterface + && this->CurrentProcessingState != ProcessingKeywordLinkInterface) + { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "The INTERFACE option must appear as the second " + "argument, just after the target name." + ); + return true; + } + this->CurrentProcessingState = ProcessingKeywordLinkInterface; + } else if(args[i] == "LINK_PUBLIC") { - if(i != 1 && this->CurrentProcessingState != ProcessingPrivateInterface) + if(i != 1 + && this->CurrentProcessingState != ProcessingPlainPrivateInterface) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, @@ -138,11 +155,28 @@ bool cmTargetLinkLibrariesCommand ); return true; } - this->CurrentProcessingState = ProcessingPublicInterface; + this->CurrentProcessingState = ProcessingPlainPublicInterface; + } + else if(args[i] == "PUBLIC") + { + if(i != 1 + && this->CurrentProcessingState != ProcessingKeywordPrivateInterface + && this->CurrentProcessingState != ProcessingKeywordPublicInterface + && this->CurrentProcessingState != ProcessingKeywordLinkInterface) + { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "The PUBLIC or PRIVATE option must appear as the second " + "argument, just after the target name." + ); + return true; + } + this->CurrentProcessingState = ProcessingKeywordPublicInterface; } else if(args[i] == "LINK_PRIVATE") { - if(i != 1 && this->CurrentProcessingState != ProcessingPublicInterface) + if(i != 1 + && this->CurrentProcessingState != ProcessingPlainPublicInterface) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, @@ -151,7 +185,23 @@ bool cmTargetLinkLibrariesCommand ); return true; } - this->CurrentProcessingState = ProcessingPrivateInterface; + this->CurrentProcessingState = ProcessingPlainPrivateInterface; + } + else if(args[i] == "PRIVATE") + { + if(i != 1 + && this->CurrentProcessingState != ProcessingKeywordPrivateInterface + && this->CurrentProcessingState != ProcessingKeywordPublicInterface + && this->CurrentProcessingState != ProcessingKeywordLinkInterface) + { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "The PUBLIC or PRIVATE option must appear as the second " + "argument, just after the target name." + ); + return true; + } + this->CurrentProcessingState = ProcessingKeywordPrivateInterface; } else if(args[i] == "debug") { @@ -184,7 +234,10 @@ bool cmTargetLinkLibrariesCommand { // The link type was specified by the previous argument. haveLLT = false; - this->HandleLibrary(args[i].c_str(), llt); + if (!this->HandleLibrary(args[i].c_str(), llt)) + { + return false; + } } else { @@ -210,7 +263,10 @@ bool cmTargetLinkLibrariesCommand llt = cmTarget::OPTIMIZED; } } - this->HandleLibrary(args[i].c_str(), llt); + if (!this->HandleLibrary(args[i].c_str(), llt)) + { + return false; + } } } @@ -257,16 +313,69 @@ cmTargetLinkLibrariesCommand } //---------------------------------------------------------------------------- -void +bool cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt) { + cmTarget::TLLSignature sig = + (this->CurrentProcessingState == ProcessingPlainPrivateInterface + || this->CurrentProcessingState == ProcessingPlainPublicInterface + || this->CurrentProcessingState == ProcessingKeywordPrivateInterface + || this->CurrentProcessingState == ProcessingKeywordPublicInterface + || this->CurrentProcessingState == ProcessingKeywordLinkInterface) + ? cmTarget::KeywordTLLSignature : cmTarget::PlainTLLSignature; + if (!this->Target->PushTLLCommandTrace(sig)) + { + const char *modal = 0; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) + { + case cmPolicies::WARN: + modal = "should"; + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + modal = "must"; + messageType = cmake::FATAL_ERROR; + } + + if(modal) + { + cmOStringStream e; + // If the sig is a keyword form and there is a conflict, the existing + // form must be the plain form. + const char *existingSig + = (sig == cmTarget::KeywordTLLSignature ? "plain" + : "keyword"); + e << this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0023) << "\n" + "The " << existingSig << " signature for target_link_libraries " + "has already been used with the target \"" + << this->Target->GetName() << "\". All uses of " + "target_link_libraries with a target " << modal << " be either " + "all-keyword or all-plain.\n"; + this->Target->GetTllSignatureTraces(e, + sig == cmTarget::KeywordTLLSignature + ? cmTarget::PlainTLLSignature + : cmTarget::KeywordTLLSignature); + this->Makefile->IssueMessage(messageType, e.str().c_str()); + if(messageType == cmake::FATAL_ERROR) + { + return false; + } + } + } + // Handle normal case first. - if(this->CurrentProcessingState != ProcessingLinkInterface) + if(this->CurrentProcessingState != ProcessingKeywordLinkInterface + && this->CurrentProcessingState != ProcessingPlainLinkInterface) { this->Makefile ->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt); - if (this->CurrentProcessingState != ProcessingPublicInterface) + if (this->CurrentProcessingState != ProcessingKeywordPublicInterface + && this->CurrentProcessingState != ProcessingPlainPublicInterface) { if (this->Target->GetType() == cmTarget::STATIC_LIBRARY) { @@ -275,8 +384,9 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, this->Target->GetDebugGeneratorExpressions(lib, llt) + ">").c_str()); } - // Not LINK_INTERFACE_LIBRARIES or LINK_PUBLIC, do not add to interface. - return; + // Not a 'public' or 'interface' library. Do not add to interface + // property. + return true; } } @@ -289,7 +399,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, if (policy22Status != cmPolicies::OLD && policy22Status != cmPolicies::WARN) { - return; + return true; } // Get the list of configurations considered to be DEBUG. @@ -327,4 +437,5 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, } } } + return true; } diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index ca651d0..f2b2543 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -109,13 +109,29 @@ public: " INTERFACE_POSITION_INDEPENDENT_CODE: Sets POSITION_INDEPENDENT_CODE\n" " or checked for consistency with existing value\n" "\n" + "If an <item> is a library in a Mac OX framework, the Headers " + "directory of the framework will also be processed as a \"usage " + "requirement\". This has the same effect as passing the framework " + "directory as an include directory." + " target_link_libraries(<target>\n" + " <PRIVATE|PUBLIC|INTERFACE> <lib> ...\n" + " [<PRIVATE|PUBLIC|INTERFACE> <lib> ... ] ...])\n" + "The PUBLIC, PRIVATE and INTERFACE keywords can be used to specify " + "both the link dependencies and the link interface in one command. " + "Libraries and targets following PUBLIC are linked to, and are " + "made part of the link interface. Libraries and targets " + "following PRIVATE are linked to, but are not made part of the " + "link interface. Libraries following INTERFACE are appended " + "to the link interface and are not used for linking <target>." + "\n" " target_link_libraries(<target> LINK_INTERFACE_LIBRARIES\n" " [[debug|optimized|general] <lib>] ...)\n" "The LINK_INTERFACE_LIBRARIES mode appends the libraries " "to the INTERFACE_LINK_LIBRARIES target property instead of using them " "for linking. If policy CMP0022 is not NEW, then this mode also " "appends libraries to the LINK_INTERFACE_LIBRARIES and its " - "per-configuration equivalent. " + "per-configuration equivalent. This signature " + "is for compatibility only. Prefer the INTERFACE mode instead. " "Libraries specified as \"debug\" are wrapped in a generator " "expression to correspond to debug builds. If policy CMP0022 is not " "NEW, the libraries are also appended to the " @@ -134,7 +150,9 @@ public: " [<LINK_PRIVATE|LINK_PUBLIC>\n" " [[debug|optimized|general] <lib>] ...])\n" "The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both " - "the link dependencies and the link interface in one command. " + "the link dependencies and the link interface in one command. This " + "signature is for compatibility only. Prefer the PUBLIC or PRIVATE " + "keywords instead. " "Libraries and targets following LINK_PUBLIC are linked to, and are " "made part of the INTERFACE_LINK_LIBRARIES. If policy CMP0022 is not " "NEW, they are also made part of the LINK_INTERFACE_LIBRARIES. " @@ -180,14 +198,17 @@ private: cmTarget* Target; enum ProcessingState { ProcessingLinkLibraries, - ProcessingLinkInterface, - ProcessingPublicInterface, - ProcessingPrivateInterface + ProcessingPlainLinkInterface, + ProcessingKeywordLinkInterface, + ProcessingPlainPublicInterface, + ProcessingKeywordPublicInterface, + ProcessingPlainPrivateInterface, + ProcessingKeywordPrivateInterface }; ProcessingState CurrentProcessingState; - void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt); + bool HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt); }; diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c index 12c39ed..24de2b2 100644 --- a/Source/cm_sha2.c +++ b/Source/cm_sha2.c @@ -740,7 +740,8 @@ void SHA1_Final(sha_byte digest[], SHA_CTX* context) { /* Convert FROM host byte order */ REVERSE64(context->s1.bitcount,context->s1.bitcount); #endif - *(sha_word64*)&context->s1.buffer[56] = context->s1.bitcount; + MEMCPY_BCOPY(&context->s1.buffer[56], &context->s1.bitcount, + sizeof(sha_word64)); /* Final transform: */ SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer); @@ -1067,7 +1068,8 @@ void SHA256_Internal_Last(SHA_CTX* context) { *context->s256.buffer = 0x80; } /* Set the bit count: */ - *(sha_word64*)&context->s256.buffer[56] = context->s256.bitcount; + MEMCPY_BCOPY(&context->s256.buffer[56], &context->s256.bitcount, + sizeof(sha_word64)); /* Final transform: */ SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer); @@ -1475,8 +1477,10 @@ void SHA512_Internal_Last(SHA_CTX* context) { *context->s512.buffer = 0x80; } /* Store the length of input data (in bits): */ - *(sha_word64*)&context->s512.buffer[112] = context->s512.bitcount[1]; - *(sha_word64*)&context->s512.buffer[120] = context->s512.bitcount[0]; + MEMCPY_BCOPY(&context->s512.buffer[112], &context->s512.bitcount[1], + sizeof(sha_word64)); + MEMCPY_BCOPY(&context->s512.buffer[120], &context->s512.bitcount[0], + sizeof(sha_word64)); /* Final transform: */ SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 77a5e43..68d8339 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -62,7 +62,10 @@ static const char * cmDocumentationDescription[][3] = " --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \ " --clean-first = Build target 'clean' first, then build.\n" \ " (To clean only, use --target 'clean'.)\n" \ - " --use-stderr = Don't merge stdout/stderr.\n" \ + " --use-stderr = Don't merge stdout/stderr output and pass the\n" \ + " original stdout/stderr handles to the native\n" \ + " tool so it can use the capabilities of the\n" \ + " calling terminal (e.g. colored output).\n" \ " -- = Pass remaining options to the native tool.\n" //---------------------------------------------------------------------------- @@ -108,9 +111,11 @@ static const char * cmDocumentationOptions[][3] = "to stdout. This can be used to use cmake instead of pkg-config to find " "installed libraries in plain Makefile-based projects or in " "autoconf-based projects (via share/aclocal/cmake.m4)."}, - {"--graphviz=[file]", "Generate graphviz of dependencies.", + {"--graphviz=[file]", "Generate graphviz of dependencies, see " + "CMakeGraphVizOptions.cmake for more.", "Generate a graphviz input file that will contain all the library and " - "executable dependencies in the project."}, + "executable dependencies in the project. See the documentation for " + "CMakeGraphVizOptions.cmake for more details. "}, {"--system-information [file]", "Dump information about this system.", "Dump a wide range of information about the current system. If run " "from the top of a binary tree for a CMake project it will dump " @@ -604,7 +609,7 @@ static int do_build(int ac, char** av) } else if(strcmp(av[i], "--use-stderr") == 0) { - outputflag = cmSystemTools::OUTPUT_NORMAL; + outputflag = cmSystemTools::OUTPUT_PASSTHROUGH; } else if(strcmp(av[i], "--") == 0) { diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 2240539..06019e6 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -124,3 +124,9 @@ add_library(libConsumer empty.cpp) target_link_libraries(libConsumer debug depA) add_subdirectory(cmp0022) + +add_executable(newsignature1 newsignature1.cpp) +target_link_libraries(newsignature1 PRIVATE depC INTERFACE depD PUBLIC depB PRIVATE subdirlib INTERFACE INTERFACE PUBLIC) + +assert_property(newsignature1 INTERFACE_LINK_LIBRARIES "depD;depB") +assert_property(newsignature1 LINK_LIBRARIES "depC;depB;subdirlib") diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt index dd6ab41..07d7c43 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -16,3 +16,12 @@ assert_property(cmp0022ifacelib INTERFACE_LINK_LIBRARIES "") add_executable(cmp0022exe cmp0022exe.cpp) target_link_libraries(cmp0022exe cmp0022lib) + +add_library(staticlib1 STATIC staticlib1.cpp) +generate_export_header(staticlib1) +add_library(staticlib2 STATIC staticlib2.cpp) +generate_export_header(staticlib2) +target_link_libraries(staticlib1 LINK_PUBLIC staticlib2) + +add_executable(staticlib_exe staticlib_exe.cpp) +target_link_libraries(staticlib_exe staticlib1) diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp new file mode 100644 index 0000000..a253c46 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp @@ -0,0 +1,2 @@ + +int staticlib1() { return 0; } diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.h new file mode 100644 index 0000000..4bbf23f --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.h @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int staticlib1(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp new file mode 100644 index 0000000..4e38063 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp @@ -0,0 +1,2 @@ + +int staticlib2() { return 0; } diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.h new file mode 100644 index 0000000..a4e07b6 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.h @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int staticlib2(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib_exe.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib_exe.cpp new file mode 100644 index 0000000..97adc40 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib_exe.cpp @@ -0,0 +1,8 @@ + +#include "staticlib1.h" +#include "staticlib2.h" + +int main() +{ + return staticlib1() + staticlib2(); +} diff --git a/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp b/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp new file mode 100644 index 0000000..d1321a1 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp @@ -0,0 +1,19 @@ + +#include "depB.h" +#include "depC.h" +#include "depIfaceOnly.h" + +#include "subdirlib.h" + +int main(int, char **) +{ + DepA a; + DepB b; + DepC c; + + DepIfaceOnly iface_only; + + SubDirLibObject sd; + + return a.foo() + b.foo() + c.foo() + iface_only.foo() + sd.foo(); +} diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index fcefaf9..440cdf0 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -225,6 +225,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(ObjectLibrary UseCshared) ADD_TEST_MACRO(NewlineArgs NewlineArgs) ADD_TEST_MACRO(SetLang SetLang) + ADD_TEST_MACRO(EmptyProperty EmptyProperty) ADD_TEST_MACRO(ExternalOBJ ExternalOBJ) ADD_TEST_MACRO(LoadCommand LoadedCommand) ADD_TEST_MACRO(LinkDirectory bin/LinkDirectory) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index ff02883..2db9282 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -91,7 +91,11 @@ gen_mcnl_test(DummyPurifyNoLogfile "\${PSEUDO_PURIFY}") gen_mcnl_test(DummyValgrindNoLogfile "\${PSEUDO_VALGRIND}") gen_mcnl_test(DummyBCNoLogfile "\${PSEUDO_BC}") -set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_PRE_MEMCHECK \"\${CTEST_MEMORYCHECK_COMMAND}\")\nset(CTEST_CUSTOM_POST_MEMCHECK \"\${CTEST_MEMORYCHECK_COMMAND}\")") +set(CTEST_EXTRA_CODE "string(REPLACE \" \" \"\\\\ \" PRE_POST_COMMAND \"\${CTEST_MEMORYCHECK_COMMAND}\") + +set(CTEST_CUSTOM_PRE_MEMCHECK \"\${PRE_POST_COMMAND} pre command\") +set(CTEST_CUSTOM_POST_MEMCHECK \"\${PRE_POST_COMMAND} post command \") +") gen_mc_test(DummyValgrindPrePost "\${PSEUDO_VALGRIND}") set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_POST_MEMCHECK \"\${ERROR_COMMAND}\")") diff --git a/Tests/CompileDefinitions/compiletest_mixed_c.c b/Tests/CompileDefinitions/compiletest_mixed_c.c index 698c989..a270b2b 100644 --- a/Tests/CompileDefinitions/compiletest_mixed_c.c +++ b/Tests/CompileDefinitions/compiletest_mixed_c.c @@ -13,6 +13,10 @@ #error Unexpected LINK_LANGUAGE_IS_C #endif +#ifndef C_EXECUTABLE_LINK_LANGUAGE_IS_C +#error Expected C_EXECUTABLE_LINK_LANGUAGE_IS_C define +#endif + void someFunc(void) { diff --git a/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp b/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp index c686854..ae6befc 100644 --- a/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp +++ b/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp @@ -13,6 +13,10 @@ #error Unexpected LINK_LANGUAGE_IS_C #endif +#ifndef C_EXECUTABLE_LINK_LANGUAGE_IS_C +#error Expected C_EXECUTABLE_LINK_LANGUAGE_IS_C define +#endif + int main(int argc, char **argv) { return 0; diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt index 6bf9c5c..a0d3f4e 100644 --- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt +++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt @@ -23,9 +23,9 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS LETTER_LIST3=\"$<JOIN:A;B;C;D,,->\" LETTER_LIST4=\"$<JOIN:A;B;C;D,-,->\" LETTER_LIST5=\"$<JOIN:A;B;C;D,-,>\" - "$<$<LINK_LANGUAGE:CXX>:LINK_CXX_DEFINE>" - "$<$<LINK_LANGUAGE:C>:LINK_C_DEFINE>" - "LINK_LANGUAGE_IS_$<LINK_LANGUAGE>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>" + "LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>" ) set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS @@ -36,16 +36,17 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS add_executable(target_prop_c_executable ../compiletest.c) set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS - "$<$<LINK_LANGUAGE:CXX>:LINK_CXX_DEFINE>" - "$<$<LINK_LANGUAGE:C>:LINK_C_DEFINE>" - "LINK_LANGUAGE_IS_$<LINK_LANGUAGE>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>" + "LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>" ) # Resulting link language will be CXX add_executable(target_prop_mixed_executable ../compiletest_mixed_c.c ../compiletest_mixed_cxx.cpp) set_property(TARGET target_prop_mixed_executable APPEND PROPERTY COMPILE_DEFINITIONS - "$<$<LINK_LANGUAGE:CXX>:LINK_CXX_DEFINE>" - "$<$<LINK_LANGUAGE:C>:LINK_C_DEFINE>" - "LINK_LANGUAGE_IS_$<LINK_LANGUAGE>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>" + "LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>" + "C_EXECUTABLE_LINK_LANGUAGE_IS_$<TARGET_PROPERTY:target_prop_c_executable,LINKER_LANGUAGE>" ) diff --git a/Tests/EmptyProperty/CMakeLists.txt b/Tests/EmptyProperty/CMakeLists.txt new file mode 100644 index 0000000..39e75f3 --- /dev/null +++ b/Tests/EmptyProperty/CMakeLists.txt @@ -0,0 +1,9 @@ +project (EmptyProperty) + +set_property(DIRECTORY APPEND + PROPERTY + COMPILE_DEFINITIONS) + +include(CTest) + +add_executable(EmptyProperty EmptyProperty.cxx) diff --git a/Tests/EmptyProperty/EmptyProperty.cxx b/Tests/EmptyProperty/EmptyProperty.cxx new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/EmptyProperty/EmptyProperty.cxx @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index f810f3b..1910f8c 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -140,6 +140,12 @@ install(FILES ) add_include_lib(testLibIncludeRequired6) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired7/testLibIncludeRequired7.h" "// No content\n") +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired7/testLibIncludeRequired7.h" + DESTINATION include/testLibIncludeRequired7 +) + set_property(TARGET testLibRequired APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:testLibIncludeRequired1,INTERFACE_INCLUDE_DIRECTORIES> @@ -154,6 +160,7 @@ set_property(TARGET testLibRequired APPEND PROPERTY $<BUILD_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired5,INTERFACE_INCLUDE_DIRECTORIES>> # Test that the below is non-fatal $<$<STREQUAL:one,two>:$<TARGET_PROPERTY:not_a_target,INTERFACE_INCLUDE_DIRECTORIES>> + $<INSTALL_INTERFACE:include/testLibIncludeRequired7> ) set_property(TARGET testLibRequired APPEND PROPERTY @@ -263,6 +270,8 @@ set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2 set_property(TARGET cmp0022OLD APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2) set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3) +add_library(noIncludesInterface empty.cpp) + install(TARGETS testLibRequired testLibIncludeRequired1 testLibIncludeRequired2 @@ -271,9 +280,27 @@ install(TARGETS testLibRequired testLibIncludeRequired5 testLibIncludeRequired6 testSharedLibRequired - EXPORT RequiredExp DESTINATION lib ) + noIncludesInterface + EXPORT RequiredExp DESTINATION lib + INCLUDES DESTINATION + installIncludesTest + $<INSTALL_PREFIX>/installIncludesTest2) install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredTargets.cmake DESTINATION lib/cmake/testLibRequired) +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h" "// No content\n") + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h" "// No content\n") +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h" + DESTINATION installIncludesTest +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h" + DESTINATION installIncludesTest2 +) + install(TARGETS testLibDepends testSharedLibDepends EXPORT DependsExp DESTINATION lib ) install(EXPORT DependsExp FILE testLibDependsTargets.cmake DESTINATION lib/cmake/testLibDepends) @@ -312,6 +339,12 @@ install( FRAMEWORK DESTINATION Frameworks BUNDLE DESTINATION Applications ) +if (APPLE) + file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/testLib4.framework/Headers) + file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/testLib4.framework/Headers) + file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release/testLib4.framework/Headers) + install(FILES testLib4.h DESTINATION Frameworks/testLib4.framework/Headers) +endif() install( TARGETS testExe2libImp testLib3Imp diff --git a/Tests/ExportImport/Export/empty.cpp b/Tests/ExportImport/Export/empty.cpp new file mode 100644 index 0000000..1787013 --- /dev/null +++ b/Tests/ExportImport/Export/empty.cpp @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() { return 0; } diff --git a/Tests/ExportImport/Export/testLib4.h b/Tests/ExportImport/Export/testLib4.h new file mode 100644 index 0000000..9eeda7c --- /dev/null +++ b/Tests/ExportImport/Export/testLib4.h @@ -0,0 +1,2 @@ + +#define TESTLIB4_H diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index aa8847b..2627354 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -210,6 +210,10 @@ if (run_pic_test) target_compile_definitions(deps_shared_iface PRIVATE CHECK_PIC_WORKS) endif() +if(APPLE) + add_subdirectory(framework_interface) +endif() + #----------------------------------------------------------------------------- # Test that targets imported from the build tree have their dependencies # evaluated correctly. The above already tests the same for the install tree. diff --git a/Tests/ExportImport/Import/A/deps_iface.c b/Tests/ExportImport/Import/A/deps_iface.c index e73ca26..48a4c44 100644 --- a/Tests/ExportImport/Import/A/deps_iface.c +++ b/Tests/ExportImport/Import/A/deps_iface.c @@ -2,6 +2,10 @@ #include "testLibIncludeRequired1.h" #include "testLibIncludeRequired2.h" #include "testLibIncludeRequired6.h" +#include "testLibIncludeRequired7.h" + +#include "installIncludesTest.h" +#include "installIncludesTest2.h" #ifndef testLibRequired_IFACE_DEFINE #error Expected testLibRequired_IFACE_DEFINE diff --git a/Tests/ExportImport/Import/A/framework_interface/CMakeLists.txt b/Tests/ExportImport/Import/A/framework_interface/CMakeLists.txt new file mode 100644 index 0000000..0e00655 --- /dev/null +++ b/Tests/ExportImport/Import/A/framework_interface/CMakeLists.txt @@ -0,0 +1,9 @@ + +add_library(exp_framework_test framework_test.cpp) +get_target_property(exp_loc exp_testLib4 LOCATION) +target_link_libraries(exp_framework_test ${exp_loc}) + + +add_library(bld_framework_test framework_test.cpp) +get_target_property(bld_loc bld_testLib4 LOCATION) +target_link_libraries(bld_framework_test ${bld_loc}) diff --git a/Tests/ExportImport/Import/A/framework_interface/framework_test.cpp b/Tests/ExportImport/Import/A/framework_interface/framework_test.cpp new file mode 100644 index 0000000..357f64f --- /dev/null +++ b/Tests/ExportImport/Import/A/framework_interface/framework_test.cpp @@ -0,0 +1,6 @@ + +#include <testLib4/testLib4.h> + +#ifndef TESTLIB4_H +#error Expected define TESTLIB4_H +#endif diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index ab936ca..7ac6ede 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -138,6 +138,31 @@ add_custom_target(check-part2 ALL VERBATIM ) +add_library(imported1 SHARED IMPORTED) +set_property(TARGET imported1 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET imported1 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) +set_property(TARGET imported1 PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) +set_property(TARGET imported1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES /imported1/include) + +add_library(imported2 SHARED IMPORTED) +set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) +set_property(TARGET imported2 PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) +set_property(TARGET imported2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES /imported2/include) + +add_library(imported3 SHARED IMPORTED) +set_property(TARGET imported3 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET imported3 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) +# Both Debug and Release should not be true when this is evaluated. +set_property(TARGET imported3 APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:DEBUG>:$<TARGET_PROPERTY:imported1,INTERFACE_INCLUDE_DIRECTORIES>>) +set_property(TARGET imported3 APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:RELEASE>:$<TARGET_PROPERTY:imported2,INTERFACE_INCLUDE_DIRECTORIES>>) + +add_library(imported4 SHARED IMPORTED) +set_property(TARGET imported4 APPEND PROPERTY + INCLUDE_DIRECTORIES $<TARGET_PROPERTY:imported3,INTERFACE_INCLUDE_DIRECTORIES>) + add_custom_target(check-part3 ALL COMMAND ${CMAKE_COMMAND} -Dtest_version_greater_1=$<VERSION_GREATER:1.0,1.1.1> @@ -146,6 +171,11 @@ add_custom_target(check-part3 ALL -Dtest_version_less_2=$<VERSION_LESS:1.0,1.1.1> -Dtest_version_equal_1=$<VERSION_EQUAL:1.0.1,1.1> -Dtest_version_equal_2=$<VERSION_EQUAL:1.1,1.1> + -Dconfig=$<CONFIGURATION> + -Dtest_imported_debug=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> + -Dtest_imported_release=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> + -Dtest_imported_relwithdebinfo=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> + -Dtest_imported_minsizerel=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)" VERBATIM diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 70d6571..af290a5 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -7,3 +7,16 @@ check(test_version_less_1 "0") check(test_version_less_2 "1") check(test_version_equal_1 "0") check(test_version_equal_2 "1") + +foreach(c debug release relwithdebinfo minsizerel) + if(config AND NOT config STREQUAL NoConfig) + if(NOT "${test_imported_${c}}" MATCHES "^;/imported2/include$" + AND NOT "${test_imported_${c}}" MATCHES "^/imported1/include;$") + message(SEND_ERROR "test_imported_${c} is not correct: ${test_imported_${c}}") + endif() + else() + if(NOT "${test_imported_${c}}" MATCHES "^;$") + message(SEND_ERROR "test_imported_${c} is not an empty list: ${test_imported_${c}}") + endif() + endif() +endforeach() diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt index 6919261..8e2bd0a 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt @@ -156,15 +156,15 @@ target_include_directories(TargetIncludeDirectories PRIVATE "${CMAKE_CURRENT_BIN # Test that the language generator expressions work set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES - "$<$<LINK_LANGUAGE:C>:${CMAKE_CURRENT_BINARY_DIR}/bad>" - "$<$<LINK_LANGUAGE:CXX>:${CMAKE_CURRENT_BINARY_DIR}/good>" - "$<$<STREQUAL:$<LINK_LANGUAGE>,CXX>:${CMAKE_CURRENT_BINARY_DIR}/othergood/>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:${CMAKE_CURRENT_BINARY_DIR}/bad>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${CMAKE_CURRENT_BINARY_DIR}/good>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${CMAKE_CURRENT_BINARY_DIR}/othergood/>" ) add_executable(TargetIncludeDirectories_C main.c) set_property(TARGET TargetIncludeDirectories_C APPEND PROPERTY INCLUDE_DIRECTORIES - "$<$<LINK_LANGUAGE:CXX>:${CMAKE_CURRENT_BINARY_DIR}/bad>" - "$<$<LINK_LANGUAGE:C>:${CMAKE_CURRENT_BINARY_DIR}/good>" - "$<$<STREQUAL:$<LINK_LANGUAGE>,C>:${CMAKE_CURRENT_BINARY_DIR}/othergood/>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${CMAKE_CURRENT_BINARY_DIR}/bad>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:${CMAKE_CURRENT_BINARY_DIR}/good>" + "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:${CMAKE_CURRENT_BINARY_DIR}/othergood/>" ) diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index bc92a94..d44cb9c 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -259,6 +259,19 @@ set_property( ${DEF_FILE_PATH} ) +# Try reading and writing the property value to ensure the string is +# preserved. +get_property(defs1 TARGET Preprocess PROPERTY COMPILE_DEFINITIONS) +set_property(TARGET Preprocess PROPERTY COMPILE_DEFINITIONS "${defs1}") +get_property(defs2 TARGET Preprocess PROPERTY COMPILE_DEFINITIONS) +if(NOT "x${defs1}" STREQUAL "x${defs2}") + message(FATAL_ERROR "get/set/get COMPILE_DEFINITIONS round trip failed. " + "First get:\n" + " ${defs1}\n" + "Second get:\n" + " ${defs2}") +endif() + # Helper target for running test manually in build tree. add_custom_target(drive COMMAND Preprocess) diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt index 6c29057..ae7627e 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt @@ -1,4 +1,4 @@ CMake Error at CMP0022-export.cmake:11 \(export\): Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style - INTERFACE_LINK_LIBRARIES properties populated, but it was exported without + LINK_INTERFACE_LIBRARIES properties populated, but it was exported without the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt index 3425e8e..405dd8d 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt @@ -1,4 +1,4 @@ CMake Error in CMakeLists.txt: Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style - INTERFACE_LINK_LIBRARIES properties populated, but it was exported without + LINK_INTERFACE_LIBRARIES properties populated, but it was exported without the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 66ce3f1..6d1bca2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -28,7 +28,7 @@ # <SubTest>-stdout.txt = Regex matching expected stdout content # <SubTest>-stderr.txt = Regex matching expected stderr content # <SubTest>-check.cmake = Custom result check -# Note that trailing newlines will be stripped from actual test +# Note that trailing newlines will be stripped from actual and expected test # output before matching against the stdout and stderr expressions. # The code in <SubTest>-check.cmake may use variables # RunCMake_TEST_SOURCE_DIR = Top of test source tree @@ -115,3 +115,5 @@ if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]") endif() add_RunCMake_test(File_Generate) +add_RunCMake_test(ExportWithoutLanguage) +add_RunCMake_test(target_link_libraries) diff --git a/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt b/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/ExportWithoutLanguage/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-result.txt b/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-stderr.txt b/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-stderr.txt new file mode 100644 index 0000000..67a0ae3 --- /dev/null +++ b/Tests/RunCMake/ExportWithoutLanguage/NoLanguage-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: CMake can not determine linker language for target: NoLanguage +CMake Error at NoLanguage.cmake:2 \(export\): + Exporting the target "NoLanguage" is not allowed since its linker language + cannot be determined +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExportWithoutLanguage/NoLanguage.cmake b/Tests/RunCMake/ExportWithoutLanguage/NoLanguage.cmake new file mode 100644 index 0000000..2ede854 --- /dev/null +++ b/Tests/RunCMake/ExportWithoutLanguage/NoLanguage.cmake @@ -0,0 +1,2 @@ +add_library(NoLanguage header.h) +export(TARGETS NoLanguage FILE "${CMAKE_CURRENT_BINARY_DIR}/export.cmake") diff --git a/Tests/RunCMake/ExportWithoutLanguage/RunCMakeTest.cmake b/Tests/RunCMake/ExportWithoutLanguage/RunCMakeTest.cmake new file mode 100644 index 0000000..f77f4eb --- /dev/null +++ b/Tests/RunCMake/ExportWithoutLanguage/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(NoLanguage) diff --git a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt index 8e0591d..a5d5d50 100644 --- a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt +++ b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex-stderr.txt @@ -1,6 +1,7 @@ CMake Error: Error evaluating generator expression: - \$<LINK_LANGUAGE> + \$<TARGET_PROPERTY:LINKER_LANGUAGE> - \$<LINK_LANGUAGE> expression can not be used while evaluating link libraries + LINKER_LANGUAGE target property can not be used while evaluating link + libraries diff --git a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex.cmake b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex.cmake index e0f8c57..64f394c 100644 --- a/Tests/RunCMake/Languages/LINK_LANGUAGE-genex.cmake +++ b/Tests/RunCMake/Languages/LINK_LANGUAGE-genex.cmake @@ -1,4 +1,4 @@ -add_library(foo SHARED empty.cpp) -add_library(bar SHARED empty.cpp) -target_link_libraries(foo $<$<STREQUAL:$<LINK_LANGUAGE>,anything>:bar>) +add_library(foo STATIC empty.cpp) +add_library(bar STATIC empty.cpp) +target_link_libraries(foo $<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,anything>:bar>) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-result.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt new file mode 100644 index 0000000..d27686d --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt @@ -0,0 +1,16 @@ +CMake Error at CMP0023-NEW-2.cmake:11 \(target_link_libraries\): + Policy CMP0023 is not set: Plain and keyword target_link_libraries + signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The plain signature for target_link_libraries has already been used with + the target "foo". All uses of target_link_libraries with a target must be + either all-keyword or all-plain. + + The uses of the plain signature are here: + + \* CMP0023-NEW-2.cmake:10 \(target_link_libraries\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake new file mode 100644 index 0000000..f8b3546 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake @@ -0,0 +1,11 @@ + +project(CMP0022-WARN) + +cmake_policy(SET CMP0023 NEW) + +add_library(foo SHARED empty_vs6_1.cpp) +add_library(bar SHARED empty_vs6_2.cpp) +add_library(bat SHARED empty_vs6_3.cpp) + +target_link_libraries(foo bar) +target_link_libraries(foo LINK_PRIVATE bat) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-result.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt new file mode 100644 index 0000000..d7be0ff --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt @@ -0,0 +1,16 @@ +CMake Error at CMP0023-NEW.cmake:11 \(target_link_libraries\): + Policy CMP0023 is not set: Plain and keyword target_link_libraries + signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The plain signature for target_link_libraries has already been used with + the target "foo". All uses of target_link_libraries with a target must be + either all-keyword or all-plain. + + The uses of the plain signature are here: + + \* CMP0023-NEW.cmake:10 \(target_link_libraries\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake new file mode 100644 index 0000000..f0aa63f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake @@ -0,0 +1,11 @@ + +project(CMP0022-WARN) + +cmake_policy(SET CMP0023 NEW) + +add_library(foo SHARED empty_vs6_1.cpp) +add_library(bar SHARED empty_vs6_2.cpp) +add_library(bat SHARED empty_vs6_3.cpp) + +target_link_libraries(foo bar) +target_link_libraries(foo PRIVATE bat) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt new file mode 100644 index 0000000..5147861 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt @@ -0,0 +1,16 @@ +CMake Warning \(dev\) at CMP0023-WARN-2.cmake:9 \(target_link_libraries\): + Policy CMP0023 is not set: Plain and keyword target_link_libraries + signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The plain signature for target_link_libraries has already been used with + the target "foo". All uses of target_link_libraries with a target should + be either all-keyword or all-plain. + + The uses of the plain signature are here: + + \* CMP0023-WARN-2.cmake:8 \(target_link_libraries\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake new file mode 100644 index 0000000..2e9cba8 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake @@ -0,0 +1,9 @@ + +project(CMP0022-WARN) + +add_library(foo SHARED empty_vs6_1.cpp) +add_library(bar SHARED empty_vs6_2.cpp) +add_library(bat SHARED empty_vs6_3.cpp) + +target_link_libraries(foo bar) +target_link_libraries(foo LINK_PRIVATE bat) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt new file mode 100644 index 0000000..a7474fa --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt @@ -0,0 +1,16 @@ +CMake Warning \(dev\) at CMP0023-WARN.cmake:9 \(target_link_libraries\): + Policy CMP0023 is not set: Plain and keyword target_link_libraries + signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The plain signature for target_link_libraries has already been used with + the target "foo". All uses of target_link_libraries with a target should + be either all-keyword or all-plain. + + The uses of the plain signature are here: + + \* CMP0023-WARN.cmake:8 \(target_link_libraries\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake new file mode 100644 index 0000000..fcc8da0 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake @@ -0,0 +1,9 @@ + +project(CMP0022-WARN) + +add_library(foo SHARED empty_vs6_1.cpp) +add_library(bar SHARED empty_vs6_2.cpp) +add_library(bat SHARED empty_vs6_3.cpp) + +target_link_libraries(foo bar) +target_link_libraries(foo PRIVATE bat) diff --git a/Tests/RunCMake/target_link_libraries/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/target_link_libraries/MixedSignature-result.txt b/Tests/RunCMake/target_link_libraries/MixedSignature-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/MixedSignature-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt b/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt new file mode 100644 index 0000000..a0c66db --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at MixedSignature.cmake:6 \(target_link_libraries\): + The PUBLIC or PRIVATE option must appear as the second argument, just after + the target name. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/MixedSignature.cmake b/Tests/RunCMake/target_link_libraries/MixedSignature.cmake new file mode 100644 index 0000000..fa70685 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/MixedSignature.cmake @@ -0,0 +1,6 @@ + +add_library(foo empty_vs6_1.cpp) +add_library(bar empty_vs6_2.cpp) +add_library(bat empty_vs6_3.cpp) + +target_link_libraries(foo LINK_PUBLIC bar PRIVATE bat) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake new file mode 100644 index 0000000..f97022e --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(CMP0023-WARN) +run_cmake(CMP0023-NEW) +run_cmake(CMP0023-WARN-2) +run_cmake(CMP0023-NEW-2) +run_cmake(MixedSignature) +run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) diff --git a/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses-result.txt b/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses.cmake b/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses.cmake new file mode 100644 index 0000000..e32891d --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses.cmake @@ -0,0 +1,9 @@ + +enable_language(CXX) + +add_library(foo empty_vs6_1.cpp) +add_library(bar empty_vs6_2.cpp) +add_library(bat empty_vs6_3.cpp) + +target_link_libraries(foo LINK_PRIVATE bar) +target_link_libraries(foo PRIVATE bat) diff --git a/Tests/RunCMake/target_link_libraries/empty.cpp b/Tests/RunCMake/target_link_libraries/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_link_libraries/empty_vs6_1.cpp b/Tests/RunCMake/target_link_libraries/empty_vs6_1.cpp new file mode 100644 index 0000000..7efedab --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/empty_vs6_1.cpp @@ -0,0 +1 @@ +#include "empty.cpp" diff --git a/Tests/RunCMake/target_link_libraries/empty_vs6_2.cpp b/Tests/RunCMake/target_link_libraries/empty_vs6_2.cpp new file mode 100644 index 0000000..7efedab --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/empty_vs6_2.cpp @@ -0,0 +1 @@ +#include "empty.cpp" diff --git a/Tests/RunCMake/target_link_libraries/empty_vs6_3.cpp b/Tests/RunCMake/target_link_libraries/empty_vs6_3.cpp new file mode 100644 index 0000000..7efedab --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/empty_vs6_3.cpp @@ -0,0 +1 @@ +#include "empty.cpp" |