diff options
56 files changed, 492 insertions, 233 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 433710b..c8b9f8b 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -291,31 +291,47 @@ optional argument topic will be appended to the argument list." (cmake-command-run "--help-command-list") ) -(defvar cmake-help-command-history nil "Topic read history.") -(defvar cmake-help-commands '() "List of available topics for --help-command.") -(defun cmake-command-list-as-list () - "Run cmake --help-command-list and return a list where each element is a cmake command." - (let ((temp-buffer-name "*CMake Commands Temporary*")) - (save-window-excursion - (cmake-command-run "--help-command-list" nil temp-buffer-name) - (with-current-buffer temp-buffer-name - (cdr (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n" t))))) +(defvar cmake-commands '() "List of available topics for --help-command.") +(defvar cmake-help-command-history nil "Command read history.") +(defvar cmake-modules '() "List of available topics for --help-module.") +(defvar cmake-help-module-history nil "Module read history.") +(defvar cmake-variables '() "List of available topics for --help-variable.") +(defvar cmake-help-variable-history nil "Variable read history.") +(defvar cmake-properties '() "List of available topics for --help-property.") +(defvar cmake-help-property-history nil "Property read history.") +(defvar cmake-help-complete-history nil "Complete help read history.") +(defvar cmake-string-to-list-symbol + '(("command" cmake-commands cmake-help-command-history) + ("module" cmake-modules cmake-help-module-history) + ("variable" cmake-variables cmake-help-variable-history) + ("property" cmake-properties cmake-help-property-history) + )) + +(defun cmake-get-list (listname) + "If the value of LISTVAR is nil, run cmake --help-LISTNAME-list +and store the result as a list in LISTVAR." + (let ((listvar (car (cdr (assoc listname cmake-string-to-list-symbol))))) + (if (not (symbol-value listvar)) + (let ((temp-buffer-name "*CMake Temporary*")) + (save-window-excursion + (cmake-command-run (concat "--help-" listname "-list") nil temp-buffer-name) + (with-current-buffer temp-buffer-name + (set listvar (cdr (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n" t)))))) + (symbol-value listvar) + )) ) (require 'thingatpt) -;;;###autoload -(defun cmake-get-command () - "Gets the topic from the minibuffer input. The default is the word the cursor is on." +(defun cmake-help-type (type) (let* ((default-entry (word-at-point)) + (history (car (cdr (cdr (assoc type cmake-string-to-list-symbol))))) (input (completing-read - "CMake command: " ; prompt - ((lambda () - (if cmake-help-commands cmake-help-commands - (setq cmake-help-commands (cmake-command-list-as-list))))) ; completions + (format "CMake %s: " type) ; prompt + (cmake-get-list type) ; completions nil ; predicate t ; require-match default-entry ; initial-input - 'cmake-help-command-history ; command history + history ))) (if (string= input "") (error "No argument given") @@ -324,10 +340,59 @@ optional argument topic will be appended to the argument list." ;;;###autoload (defun cmake-help-command () - "Prints out the help message corresponding to the command the cursor is on." + "Prints out the help message for the command the cursor is on." + (interactive) + (cmake-command-run "--help-command" (cmake-help-type "command") "*CMake Help*")) + +;;;###autoload +(defun cmake-help-module () + "Prints out the help message for the module the cursor is on." (interactive) - (cmake-command-run "--help-command" (downcase (cmake-get-command)) "*CMake Help*")) + (cmake-command-run "--help-module" (cmake-help-type "module") "*CMake Help*")) +;;;###autoload +(defun cmake-help-variable () + "Prints out the help message for the variable the cursor is on." + (interactive) + (cmake-command-run "--help-variable" (cmake-help-type "variable") "*CMake Help*")) + +;;;###autoload +(defun cmake-help-property () + "Prints out the help message for the property the cursor is on." + (interactive) + (cmake-command-run "--help-property" (cmake-help-type "property") "*CMake Help*")) + +;;;###autoload +(defun cmake-help () + "Queries for any of the four available help topics and prints out the approriate page." + (interactive) + (let* ((default-entry (word-at-point)) + (command-list (cmake-get-list "command")) + (variable-list (cmake-get-list "variable")) + (module-list (cmake-get-list "module")) + (property-list (cmake-get-list "property")) + (all-words (append command-list variable-list module-list property-list)) + (input (completing-read + "CMake command/module/variable/property: " ; prompt + all-words ; completions + nil ; predicate + t ; require-match + default-entry ; initial-input + 'cmake-help-complete-history + ))) + (if (string= input "") + (error "No argument given") + (if (member input command-list) + (cmake-command-run "--help-command" input "*CMake Help*") + (if (member input variable-list) + (cmake-command-run "--help-variable" input "*CMake Help*") + (if (member input module-list) + (cmake-command-run "--help-module" input "*CMake Help*") + (if (member input property-list) + (cmake-command-run "--help-property" input "*CMake Help*") + (error "Not a know help topic.") ; this really should not happen + )))))) + ) ;;;###autoload (progn diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 972a9f8..8650a58 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -100,3 +100,5 @@ All Policies /policy/CMP0046 /policy/CMP0047 /policy/CMP0048 + /policy/CMP0049 + /policy/CMP0050 diff --git a/Help/policy/CMP0049.rst b/Help/policy/CMP0049.rst new file mode 100644 index 0000000..5c8d4a8 --- /dev/null +++ b/Help/policy/CMP0049.rst @@ -0,0 +1,23 @@ +CMP0049 +------- + +Do not expand variables in target source entries. + +CMake 2.8.12 and lower performed and extra layer of variable expansion +when evaluating source file names: + +.. code-block:: cmake + + set(a_source foo.c) + add_executable(foo \${a_source}) + +This was undocumented behavior. + +The OLD behavior for this policy is to expand such variables when processing +the target sources. The NEW behavior for this policy is to issue an error +if such variables need to be expanded. + +This policy was introduced in CMake version 3.0. +CMake version |release| warns when the policy is not set and uses +OLD behavior. Use the cmake_policy command to set it to OLD or +NEW explicitly. diff --git a/Help/policy/CMP0050.rst b/Help/policy/CMP0050.rst new file mode 100644 index 0000000..76ae0aa --- /dev/null +++ b/Help/policy/CMP0050.rst @@ -0,0 +1,18 @@ +CMP0050 +------- + +Disallow add_custom_command SOURCE signatures. + +CMake 2.8.12 and lower allowed a signature for :command:`add_custom_command` +which specified an input to a command. This was undocumented behavior. +Modern use of CMake associates custom commands with their output, rather +than their input. + +The OLD behavior for this policy is to allow the use of +:command:`add_custom_command` SOURCE signatures. The NEW behavior for this +policy is to issue an error if such a signature is used. + +This policy was introduced in CMake version 3.0. +CMake version |release| warns when the policy is not set and uses +OLD behavior. Use the cmake_policy command to set it to OLD or +NEW explicitly. diff --git a/Help/release/3.0.rst b/Help/release/3.0.rst index bef7715..45f7635 100644 --- a/Help/release/3.0.rst +++ b/Help/release/3.0.rst @@ -322,6 +322,14 @@ New Diagnostics messages up front and stops processing when no working compiler is known to be available. +* Target sources specified with the :command:`add_library` or + :command:`add_executable` command learned to reject items which + require an undocumented extra layer of variable expansion. + See policy :policy:`CMP0049`. + +* Use of :command:`add_custom_command` undocumented ``SOURCE`` + signatures now results in an error. See policy :policy:`CMP0050`. + Deprecated and Removed Features =============================== diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index ae8baab..945694d 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -305,10 +305,15 @@ endmacro() macro(_Boost_FIND_LIBRARY var) find_library(${var} ${ARGN}) - # If we found the first library save Boost_LIBRARY_DIR. - if(${var} AND NOT Boost_LIBRARY_DIR) - get_filename_component(_dir "${${var}}" PATH) - set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE) + if(${var}) + # If this is the first library found then save Boost_LIBRARY_DIR. + if(NOT Boost_LIBRARY_DIR) + get_filename_component(_dir "${${var}}" PATH) + set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE) + endif() + elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + # Try component-specific hints but do not save Boost_LIBRARY_DIR. + find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN}) endif() # If Boost_LIBRARY_DIR is known then search only there. @@ -935,6 +940,28 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) set( _boost_docstring_release "Boost ${COMPONENT} library (release)") set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") + # Compute component-specific hints. + set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") + if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python") + foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) + if(IS_ABSOLUTE "${lib}") + get_filename_component(libdir "${lib}" PATH) + string(REPLACE "\\" "/" libdir "${libdir}") + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir}) + endif() + endforeach() + endif() + + # Consolidate and report component-specific hints. + if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Component-specific library search paths for ${COMPONENT}: " + "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}") + endif() + endif() + # # Find RELEASE libraries # diff --git a/Modules/Platform/Darwin-Intel-C.cmake b/Modules/Platform/Darwin-Intel-C.cmake new file mode 100644 index 0000000..81c630f --- /dev/null +++ b/Modules/Platform/Darwin-Intel-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Intel) +__darwin_compiler_intel(C) diff --git a/Modules/Platform/Darwin-Intel-CXX.cmake b/Modules/Platform/Darwin-Intel-CXX.cmake new file mode 100644 index 0000000..90ae53b --- /dev/null +++ b/Modules/Platform/Darwin-Intel-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Intel) +__darwin_compiler_intel(CXX) diff --git a/Modules/Platform/Darwin-Intel-Fortran.cmake b/Modules/Platform/Darwin-Intel-Fortran.cmake index 6bd45f1..a604bb6 100644 --- a/Modules/Platform/Darwin-Intel-Fortran.cmake +++ b/Modules/Platform/Darwin-Intel-Fortran.cmake @@ -11,5 +11,8 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +include(Platform/Darwin-Intel) +__darwin_compiler_intel(Fortran) + set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-current_version ") diff --git a/Modules/Platform/Darwin-Intel.cmake b/Modules/Platform/Darwin-Intel.cmake new file mode 100644 index 0000000..42f1154 --- /dev/null +++ b/Modules/Platform/Darwin-Intel.cmake @@ -0,0 +1,29 @@ + +#============================================================================= +# Copyright 2002-2014 Kitware, Inc. +# +# 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.) + +# This module is shared by multiple languages; use include blocker. +if(__DARWIN_COMPILER_INTEL) + return() +endif() +set(__DARWIN_COMPILER_INTEL 1) + +macro(__darwin_compiler_intel lang) + set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") + + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + endif() +endmacro() diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake deleted file mode 100644 index c7e31c0..0000000 --- a/Modules/Platform/Darwin-icc.cmake +++ /dev/null @@ -1,131 +0,0 @@ -set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "" ) -set(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "") - -# Setup for Leopard Compatibility -exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE _OSX_VERSION) -# message (STATUS "_OSX_VERSION: ${_OSX_VERSION}") -if ( _OSX_VERSION MATCHES "^10.4" ) - #if(CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS_INIT "") - set (CMAKE_C_FLAGS_DEBUG_INIT "-gdwarf-2") - set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - set (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2") - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") - # endif() - -# if(CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_FLAGS_INIT "") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "-gdwarf-2") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2") - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") -# endif() -endif () - - -set(CMAKE_SHARED_LIBRARY_PREFIX "lib") -set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") -set(CMAKE_SHARED_MODULE_PREFIX "lib") -set(CMAKE_SHARED_MODULE_SUFFIX ".so") -set(CMAKE_MODULE_EXISTS 1) -set(CMAKE_DL_LIBS "") -set(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") -set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") -set(CMAKE_PLATFORM_HAS_INSTALLNAME 1) -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") -set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") -set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") - - -# setup for universal binaries if sysroot exists -if(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) - # set the sysroot to be used if CMAKE_OSX_ARCHITECTURES - # has more than one value - set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk CACHE STRING - "isysroot used for universal binary support") - # set _CMAKE_OSX_MACHINE to umame -m - exec_program(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) - - # check for environment variable CMAKE_OSX_ARCHITECTURES - # if it is set. - if(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") - set(_CMAKE_OSX_MACHINE "$ENV{CMAKE_OSX_ARCHITECTURES}") - endif() - # now put _CMAKE_OSX_MACHINE into the cache - set(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE} - CACHE STRING "Build architectures for OSX") -endif() - -if(NOT XCODE) - # Enable shared library versioning. This flag is not actually referenced - # but the fact that the setting exists will cause the generators to support - # soname computation. - set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") - set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name") - set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name") -endif() - -# Xcode does not support -isystem yet. -if(XCODE) - set(CMAKE_INCLUDE_SYSTEM_FLAG_C) - set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) -endif() - -if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) - set(CMAKE_C_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") - set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") -endif() - - -set(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>") - -set(CMAKE_C_CREATE_SHARED_LIBRARY - "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") -set(CMAKE_CXX_CREATE_SHARED_LIBRARY - "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") -set(CMAKE_Fortran_CREATE_SHARED_LIBRARY - "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") - -set(CMAKE_CXX_CREATE_SHARED_MODULE - "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") - -set(CMAKE_C_CREATE_SHARED_MODULE - "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") - -set(CMAKE_Fortran_CREATE_SHARED_MODULE - "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") - - -# We can use $ENV{INTEL_LICENSE_FILE} to try and get at the installation location for ICC. -# We also need to consider to use cce (which is the 64bit compiler) and not JUST the 32bit compiler. -# I have no idea what the best way to do that would be. - - -# default to searching for frameworks first -if(NOT DEFINED CMAKE_FIND_FRAMEWORK) - set(CMAKE_FIND_FRAMEWORK FIRST) -endif() -# set up the default search directories for frameworks -set(CMAKE_SYSTEM_FRAMEWORK_PATH - ~/Library/Frameworks - /Library/Frameworks - /Network/Library/Frameworks - /System/Library/Frameworks) - -# default to searching for application bundles first -if(NOT DEFINED CMAKE_FIND_APPBUNDLE) - set(CMAKE_FIND_APPBUNDLE FIRST) -endif() -# set up the default search directories for application bundles -set(CMAKE_SYSTEM_APPBUNDLE_PATH - ~/Applications - /Applications - /Developer/Applications) - -include(Platform/UnixPaths) -set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /sw/include) -set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /sw/lib) diff --git a/Modules/Platform/Darwin-icpc.cmake b/Modules/Platform/Darwin-icpc.cmake deleted file mode 100644 index 549feb7..0000000 --- a/Modules/Platform/Darwin-icpc.cmake +++ /dev/null @@ -1,3 +0,0 @@ -get_filename_component(CURRENT_SOURCE_PARENT ${CMAKE_CURRENT_LIST_FILE} PATH) -#message (STATUS "CURRENT_SOURCE_PARENT: ${CURRENT_SOURCE_PARENT}") -include ( ${CURRENT_SOURCE_PARENT}/Darwin-icc.cmake) diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake index d1694d6..449493a 100644 --- a/Modules/Platform/Linux-Intel-C.cmake +++ b/Modules/Platform/Linux-Intel-C.cmake @@ -1,2 +1,3 @@ include(Platform/Linux-Intel) __linux_compiler_intel(C) +set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ") diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake index 66df3ac..142b6cf 100644 --- a/Modules/Platform/Linux-Intel-CXX.cmake +++ b/Modules/Platform/Linux-Intel-CXX.cmake @@ -1,2 +1,3 @@ include(Platform/Linux-Intel) __linux_compiler_intel(CXX) +set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4bbbd75..a8f7aa4 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 12) -set(CMake_VERSION_TWEAK 20140212) +set(CMake_VERSION_TWEAK 20140217) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index 5db01f9..3b9d552 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmCTestReadCustomFilesCommand.h" - #include "cmCTest.h" bool cmCTestReadCustomFilesCommand diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 5634849..3de04f5 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -344,6 +344,36 @@ bool cmAddCustomCommandCommand } else { + bool issueMessage = true; + cmOStringStream e; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0050)) + { + case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0050)) << "\n"; + break; + case cmPolicies::OLD: + issueMessage = false; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + messageType = cmake::FATAL_ERROR; + break; + } + + if (issueMessage) + { + e << "The SOURCE signatures of add_custom_command are no longer " + "supported."; + this->Makefile->IssueMessage(messageType, e.str().c_str()); + if (messageType == cmake::FATAL_ERROR) + { + return false; + } + } + // Use the old-style mode for backward compatibility. this->Makefile->AddCustomCommandOldStyle(target.c_str(), outputs, depends, source.c_str(), commandLines, diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 858f76c..a77bc68 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -52,7 +52,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) } if (te->GetType() == cmTarget::INTERFACE_LIBRARY) { - this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007"); // 2.8.13 + this->GenerateRequiredCMakeVersion(os, DEVEL_CMAKE_VERSION(3, 0, 0)); } } diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 1438f4d..8be4bbf 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -15,6 +15,21 @@ #include "cmCommand.h" #include "cmGeneratorExpression.h" +#include "cmVersionMacros.h" +#include "cmVersion.h" + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +#define DEVEL_CMAKE_VERSION(maj, min, patch) \ + (CMake_VERSION_ENCODE(maj, min, patch) > \ + CMake_VERSION_ENCODE(CMake_VERSION_MAJOR, CMake_VERSION_MINOR, \ + CMake_VERSION_PATCH) \ + ) ? \ + STRINGIFY(CMake_VERSION_MAJOR) "." STRINGIFY(CMake_VERSION_MINOR) "." \ + STRINGIFY(CMake_VERSION_PATCH) "." STRINGIFY(CMake_VERSION_TWEAK) \ + : #maj "." #min "." #patch + class cmTargetExport; /** \class cmExportFileGenerator diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 56c0ec1..8b59665 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -19,20 +19,6 @@ #include "cmInstallExportGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmTargetExport.h" -#include "cmVersionMacros.h" -#include "cmVersion.h" - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -#define DEVEL_CMAKE_VERSION(maj, min, patch) \ - (CMake_VERSION_ENCODE(maj, min, patch) > \ - CMake_VERSION_ENCODE(CMake_VERSION_MAJOR, CMake_VERSION_MINOR, \ - CMake_VERSION_PATCH) \ - ) ? \ - STRINGIFY(CMake_VERSION_MAJOR) "." STRINGIFY(CMake_VERSION_MINOR) "." \ - STRINGIFY(CMake_VERSION_PATCH) "." STRINGIFY(CMake_VERSION_TWEAK) \ - : #maj "." #min "." #patch //---------------------------------------------------------------------------- cmExportInstallFileGenerator diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index d0f83b2..a0d37d4 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -98,12 +98,12 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, "\t\t\"clean_target\": \"clean\",\n"; // build, clean and quick are for the build plugin kate <= 4.12: - fout << "\t\t\"build\": \"" << make << " -C " << homeOutputDir - << " " << makeArgs << " " << "all\",\n"; - fout << "\t\t\"clean\": \"" << make << " -C " << homeOutputDir - << " " << makeArgs << " " << "clean\",\n"; - fout << "\t\t\"quick\": \"" << make << " -C " << homeOutputDir - << " " << makeArgs << " " << "install\",\n"; + fout << "\t\t\"build\": \"" << make << " -C \\\"" << homeOutputDir + << "\\\" " << makeArgs << " " << "all\",\n"; + fout << "\t\t\"clean\": \"" << make << " -C \\\"" << homeOutputDir + << "\\\" " << makeArgs << " " << "clean\",\n"; + fout << "\t\t\"quick\": \"" << make << " -C \\\"" << homeOutputDir + << "\\\" " << makeArgs << " " << "install\",\n"; // this is for kate >= 4.13: fout << @@ -225,9 +225,9 @@ cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout, fout << "\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", " "\"build_cmd\":\"" << make - << " -C " << (this->UseNinja ? homeOutputDir : path.c_str()) - << " " << makeArgs << " " - << target << "\"}\n"; + << " -C \\\"" << (this->UseNinja ? homeOutputDir : path.c_str()) + << "\\\" " << makeArgs << " " + << target << "\"}\n"; JsonSep = ','; } diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 52411e8..604bfcc 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -403,7 +403,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, lg->AppendFlags(flags, makefile->GetDefineFlags()); // Add target-specific flags. - lg->AddCompileOptions(flags, target, config, language); + lg->AddCompileOptions(flags, target, language, config); // Add source file specific flags. lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2573c85..175bb0e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -498,11 +498,14 @@ cmTargetTraceDependencies // Queue all the source files already specified for the target. std::vector<cmSourceFile*> sources; - this->Target->GetSourceFiles(sources); - for(std::vector<cmSourceFile*>::const_iterator si = sources.begin(); - si != sources.end(); ++si) + if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY) { - this->QueueSource(*si); + this->Target->GetSourceFiles(sources); + for(std::vector<cmSourceFile*>::const_iterator si = sources.begin(); + si != sources.end(); ++si) + { + this->QueueSource(*si); + } } // Queue pre-build, pre-link, and post-build rule dependencies. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a61cab1..0c44681 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1468,7 +1468,8 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects() for(cmGeneratorTargetsType::iterator ti = targets.begin(); ti != targets.end(); ++ti) { - if (ti->second->Target->IsImported()) + if (ti->second->Target->IsImported() + || ti->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b8b7035..aca195c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1972,7 +1972,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, flags += " "; flags += sysrootFlag; flags += " "; - flags += sysroot; + flags += this->Convert(sysroot, NONE, SHELL); } if (deploymentTargetFlag && *deploymentTargetFlag && diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 82f8d1b..900af8d 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -129,15 +129,6 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, const std::string& language) { - std::string flags; - - this->AddFeatureFlags(flags, language.c_str()); - - this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GeneratorTarget, - language.c_str(), - this->GetConfigName()); - // TODO: Fortran support. // // Fortran-specific flags computed for this target. // if(*l == "Fortran") @@ -145,42 +136,56 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, // this->AddFortranFlags(flags); // } - // Add shared-library flags if needed. - this->LocalGenerator->AddCMP0018Flags(flags, this->Target, - language.c_str(), - this->GetConfigName()); - - this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, - language.c_str()); - - // Add include directory flags. - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); - { - std::vector<std::string> includes; - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - language.c_str(), config); - std::string includeFlags = - this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, - language.c_str(), - language == "RC" ? true : false); // full include paths for RC - // needed by cmcldeps - if(cmGlobalNinjaGenerator::IsMinGW()) - cmSystemTools::ReplaceString(includeFlags, "\\", "/"); - - this->LocalGenerator->AppendFlags(flags, includeFlags.c_str()); - } - - // Append old-style preprocessor definition flags. - this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags()); + bool hasLangCached = this->LanguageFlags.count(language) != 0; + std::string& languageFlags = this->LanguageFlags[language]; + if(!hasLangCached) + { + this->AddFeatureFlags(languageFlags, language.c_str()); + + this->GetLocalGenerator()->AddArchitectureFlags(languageFlags, + this->GeneratorTarget, + language.c_str(), + this->GetConfigName()); + + // Add shared-library flags if needed. + this->LocalGenerator->AddCMP0018Flags(languageFlags, this->Target, + language, + this->GetConfigName()); + + this->LocalGenerator->AddVisibilityPresetFlags(languageFlags, this->Target, + language.c_str()); + + std::vector<std::string> includes; + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + language.c_str(), + this->GetConfigName()); + // Add include directory flags. + std::string includeFlags = + this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, + language.c_str(), + language == "RC" ? true : false); // full include paths for RC + // needed by cmcldeps + if(cmGlobalNinjaGenerator::IsMinGW()) + cmSystemTools::ReplaceString(includeFlags, "\\", "/"); + + this->LocalGenerator->AppendFlags(languageFlags, includeFlags.c_str()); + + // Append old-style preprocessor definition flags. + this->LocalGenerator->AppendFlags(languageFlags, + this->Makefile->GetDefineFlags()); + + // Add target-specific flags. + this->LocalGenerator->AddCompileOptions(languageFlags, this->Target, + language.c_str(), + this->GetConfigName()); + } - // Add target-specific flags. - this->LocalGenerator->AddCompileOptions(flags, this->Target, - language.c_str(), config); + std::string flags = languageFlags; - // Add source file specific flags. - this->LocalGenerator->AppendFlags(flags, - source->GetProperty("COMPILE_FLAGS")); + // Add source file specific flags. + this->LocalGenerator->AppendFlags(flags, + source->GetProperty("COMPILE_FLAGS")); // TODO: Handle Apple frameworks. diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 2ce1ed7..43f2279 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -154,6 +154,9 @@ private: /// List of object files for this target. cmNinjaDeps Objects; + typedef std::map<std::string, std::string> LanguageFlagMap; + LanguageFlagMap LanguageFlags; + // The windows module definition source file (.def), if any. std::string ModuleDefinitionFile; }; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 9cfa1e4..93072f5 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -333,6 +333,16 @@ cmPolicies::cmPolicies() CMP0048, "CMP0048", "project() command manages VERSION variables.", 3,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0049, "CMP0049", + "Do not expand variables in target source entries.", + 3,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0050, "CMP0050", + "Disallow add_custom_command SOURCE signatures.", + 3,0,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index f9a4768..b77235d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -102,6 +102,8 @@ public: CMP0046, ///< Error on non-existent dependency in add_dependencies CMP0047, ///< Use QCC compiler id for the qcc drivers on QNX. CMP0048, ///< project() command manages VERSION variables + CMP0049, ///< Do not expand variables in target source entries + CMP0050, ///< Disallow add_custom_command SOURCE signatures /** \brief Always the last entry. * diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d440f7c..db34bd8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -551,6 +551,7 @@ bool cmTarget::FindSourceFiles() //---------------------------------------------------------------------------- void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const { + assert(this->GetType() != INTERFACE_LIBRARY); files = this->SourceFiles; } @@ -590,6 +591,38 @@ cmSourceFile* cmTarget::AddSource(const char* s) // For backwards compatibility replace varibles in source names. // This should eventually be removed. this->Makefile->ExpandVariablesInString(src); + if (src != s) + { + cmOStringStream e; + bool noMessage = false; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0049)) + { + case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0049)) << "\n"; + break; + case cmPolicies::OLD: + noMessage = true; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + messageType = cmake::FATAL_ERROR; + } + if (!noMessage) + { + e << "Legacy variable expansion in source file \"" + << s << "\" expanded to \"" << src << "\" in target \"" + << this->GetName() << "\". This behavior will be removed in a " + "future version of CMake."; + this->Makefile->IssueMessage(messageType, e.str().c_str()); + if (messageType == cmake::FATAL_ERROR) + { + return 0; + } + } + } cmSourceFile* sf = this->Makefile->GetOrCreateSource(src.c_str()); this->AddSourceFile(sf); diff --git a/Tests/RunCMake/CMP0049/CMP0049-NEW-result.txt b/Tests/RunCMake/CMP0049/CMP0049-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt b/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt new file mode 100644 index 0000000..ff787e8 --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMP0049-NEW.cmake:5 \(add_library\): + Legacy variable expansion in source file "\${tgt_srcs}" expanded to + "empty.cpp" in target "tgt". This behavior will be removed in a future + version of CMake. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake b/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake new file mode 100644 index 0000000..85b5aa8 --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake @@ -0,0 +1,5 @@ + +cmake_policy(SET CMP0049 NEW) + +set(tgt_srcs empty.cpp) +add_library(tgt \${tgt_srcs}) diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt b/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt b/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake b/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake new file mode 100644 index 0000000..ae6fd3b --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake @@ -0,0 +1,5 @@ + +cmake_policy(SET CMP0049 OLD) + +set(tgt_srcs empty.cpp) +add_library(tgt \${tgt_srcs}) diff --git a/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt b/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt b/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt new file mode 100644 index 0000000..0cf5ce3 --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at CMP0049-WARN.cmake:3 \(add_library\): + Policy CMP0049 is not set: Do not expand variables in target source + entries. Run "cmake --help-policy CMP0049" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Legacy variable expansion in source file "\${tgt_srcs}" expanded to + "empty.cpp" in target "tgt". This behavior will be removed in a future + version of CMake. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0049/CMP0049-WARN.cmake b/Tests/RunCMake/CMP0049/CMP0049-WARN.cmake new file mode 100644 index 0000000..ada082e --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-WARN.cmake @@ -0,0 +1,3 @@ + +set(tgt_srcs empty.cpp) +add_library(tgt \${tgt_srcs}) diff --git a/Tests/RunCMake/CMP0049/CMakeLists.txt b/Tests/RunCMake/CMP0049/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0049/RunCMakeTest.cmake b/Tests/RunCMake/CMP0049/RunCMakeTest.cmake new file mode 100644 index 0000000..a8aa9d9 --- /dev/null +++ b/Tests/RunCMake/CMP0049/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0049-OLD) +run_cmake(CMP0049-NEW) +run_cmake(CMP0049-WARN) diff --git a/Tests/RunCMake/CMP0049/empty.cpp b/Tests/RunCMake/CMP0049/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0049/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0050/CMP0050-NEW-result.txt b/Tests/RunCMake/CMP0050/CMP0050-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0050/CMP0050-NEW-stderr.txt b/Tests/RunCMake/CMP0050/CMP0050-NEW-stderr.txt new file mode 100644 index 0000000..e913b3f --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0050-NEW.cmake:5 \(add_custom_command\): + The SOURCE signatures of add_custom_command are no longer supported. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0050/CMP0050-NEW.cmake b/Tests/RunCMake/CMP0050/CMP0050-NEW.cmake new file mode 100644 index 0000000..cdc65b8 --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-NEW.cmake @@ -0,0 +1,13 @@ + +cmake_policy(SET CMP0050 NEW) + +add_library(empty empty.cpp) +add_custom_command( + TARGET empty + SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in + ${CMAKE_CURRENT_BINARY_DIR}/input.h + OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/input.h + DEPENDS ${CMAKE_COMMAND} +) diff --git a/Tests/RunCMake/CMP0050/CMP0050-OLD-result.txt b/Tests/RunCMake/CMP0050/CMP0050-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt b/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0050/CMP0050-OLD.cmake b/Tests/RunCMake/CMP0050/CMP0050-OLD.cmake new file mode 100644 index 0000000..efb37e5 --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-OLD.cmake @@ -0,0 +1,13 @@ + +cmake_policy(SET CMP0050 OLD) + +add_library(empty empty.cpp) +add_custom_command( + TARGET empty + SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in + ${CMAKE_CURRENT_BINARY_DIR}/input.h + OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/input.h + DEPENDS ${CMAKE_COMMAND} +) diff --git a/Tests/RunCMake/CMP0050/CMP0050-WARN-result.txt b/Tests/RunCMake/CMP0050/CMP0050-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0050/CMP0050-WARN-stderr.txt b/Tests/RunCMake/CMP0050/CMP0050-WARN-stderr.txt new file mode 100644 index 0000000..c88d595 --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-WARN-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0050-WARN.cmake:3 \(add_custom_command\): + Policy CMP0050 is not set: Disallow add_custom_command SOURCE signatures. + Run "cmake --help-policy CMP0050" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The SOURCE signatures of add_custom_command are no longer supported. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0050/CMP0050-WARN.cmake b/Tests/RunCMake/CMP0050/CMP0050-WARN.cmake new file mode 100644 index 0000000..e57230e --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-WARN.cmake @@ -0,0 +1,11 @@ + +add_library(empty empty.cpp) +add_custom_command( + TARGET empty + SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input.h.in + ${CMAKE_CURRENT_BINARY_DIR}/input.h + OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/input.h + DEPENDS ${CMAKE_COMMAND} +) diff --git a/Tests/RunCMake/CMP0050/CMakeLists.txt b/Tests/RunCMake/CMP0050/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0050/RunCMakeTest.cmake b/Tests/RunCMake/CMP0050/RunCMakeTest.cmake new file mode 100644 index 0000000..b7de284 --- /dev/null +++ b/Tests/RunCMake/CMP0050/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0050-OLD) +run_cmake(CMP0050-NEW) +run_cmake(CMP0050-WARN) diff --git a/Tests/RunCMake/CMP0050/empty.cpp b/Tests/RunCMake/CMP0050/empty.cpp new file mode 100644 index 0000000..182ea29 --- /dev/null +++ b/Tests/RunCMake/CMP0050/empty.cpp @@ -0,0 +1,10 @@ + +#include "input.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0050/input.h.in b/Tests/RunCMake/CMP0050/input.h.in new file mode 100644 index 0000000..d8c5d26 --- /dev/null +++ b/Tests/RunCMake/CMP0050/input.h.in @@ -0,0 +1,2 @@ + +#define INPUT diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index c29b736..9bb097b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -32,6 +32,8 @@ endif() add_RunCMake_test(CMP0043) add_RunCMake_test(CMP0045) add_RunCMake_test(CMP0046) +add_RunCMake_test(CMP0049) +add_RunCMake_test(CMP0050) add_RunCMake_test(CTest) if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) |