diff options
174 files changed, 2511 insertions, 992 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e4cd15..41ff4a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -451,7 +451,7 @@ endif() # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests. # # If not defined or "", this variable defaults to the server at -# http://www.cdash.org/CDash. +# "http://open.cdash.org". # # If set explicitly to "NOTFOUND", curl tests and ctest tests that use # the network are skipped. @@ -462,7 +462,7 @@ endif() # should be run first. # if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") - set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") + set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org") endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 819f9ba..df2f94c 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -13,8 +13,8 @@ set(CTEST_PROJECT_NAME "CMake") set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_CDASH_VERSION "1.6") set(CTEST_CDASH_QUERY_VERSION TRUE) diff --git a/DartConfig.cmake b/DartConfig.cmake index 37f66c7..92dffca 100644 --- a/DartConfig.cmake +++ b/DartConfig.cmake @@ -13,6 +13,6 @@ set(CTEST_PROJECT_NAME "CMake") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Help/command/file.rst b/Help/command/file.rst index 869350a..58e3a26 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -298,6 +298,7 @@ See the :command:`install(DIRECTORY)` command for documentation of permissions, ``PATTERN``, ``REGEX``, and ``EXCLUDE`` options. The ``INSTALL`` signature differs slightly from ``COPY``: it prints -status messages, and ``NO_SOURCE_PERMISSIONS`` is default. +status messages (subject to the :variable:`CMAKE_INSTALL_MESSAGE` variable), +and ``NO_SOURCE_PERMISSIONS`` is default. Installation scripts generated by the :command:`install` command use this signature (with some undocumented options for internal use). diff --git a/Help/command/install.rst b/Help/command/install.rst index 47108f0..4c52abf 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -1,8 +1,15 @@ install ------- +.. only:: html + + .. contents:: + Specify rules to run at install time. +Introduction +^^^^^^^^^^^^ + This command generates installation rules for a project. Rules specified by calls to this command within a source directory are executed in order during installation. The order across directories @@ -52,7 +59,12 @@ signatures that specify them. The common options are: Specify that it is not an error if the file to be installed does not exist. ------------------------------------------------------------------------------- +Command signatures that install files may print messages during +installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable +to control which messages are printed. + +Installing Targets +^^^^^^^^^^^^^^^^^^ :: @@ -147,7 +159,8 @@ file itself, call ``install(EXPORT)``, documented below. Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property set to ``TRUE`` has undefined behavior. ------------------------------------------------------------------------------- +Installing Files +^^^^^^^^^^^^^^^^ :: @@ -175,14 +188,15 @@ The list of ``files...`` given to ``FILES`` or ``PROGRAMS`` may use However, if any item begins in a generator expression it must evaluate to a full path. ------------------------------------------------------------------------------- +Installing Directories +^^^^^^^^^^^^^^^^^^^^^^ :: install(DIRECTORY dirs... DESTINATION <dir> [FILE_PERMISSIONS permissions...] [DIRECTORY_PERMISSIONS permissions...] - [USE_SOURCE_PERMISSIONS] [OPTIONAL] + [USE_SOURCE_PERMISSIONS] [OPTIONAL] [MESSAGE_NEVER] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT <component>] [FILES_MATCHING] [[PATTERN <pattern> | REGEX <regex>] @@ -205,6 +219,8 @@ permissions specified in the ``FILES`` form of the command, and the directories will be given the default permissions specified in the ``PROGRAMS`` form of the command. +The ``MESSAGE_NEVER`` option disables file installation status output. + Installation of directories may be controlled with fine granularity using the ``PATTERN`` or ``REGEX`` options. These "match" options specify a globbing pattern or regular expression to match directories or files @@ -247,7 +263,8 @@ will install the ``icons`` directory to ``share/myproj/icons`` and the file permissions, the scripts will be given specific permissions, and any ``CVS`` directories will be excluded. ------------------------------------------------------------------------------- +Custom Installation Logic +^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -266,7 +283,8 @@ example, the code will print a message during installation. ------------------------------------------------------------------------------- +Installing Exports +^^^^^^^^^^^^^^^^^^ :: diff --git a/Help/generator/Visual Studio 14.rst b/Help/generator/Visual Studio 14.rst new file mode 100644 index 0000000..7f4fdc3 --- /dev/null +++ b/Help/generator/Visual Studio 14.rst @@ -0,0 +1,9 @@ +Visual Studio 14 +---------------- + +Generates Visual Studio 14 project files. + +It is possible to append a space followed by the platform name to +create project files for a specific target platform. E.g. +"Visual Studio 14 Win64" will create project files for the +x64 processor; "Visual Studio 14 ARM" for ARM. diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 8d0c704..7f5093f 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -64,6 +64,7 @@ one may launch CMake from any environment. /generator/Visual Studio 10 2010 /generator/Visual Studio 11 2012 /generator/Visual Studio 12 2013 + /generator/Visual Studio 14 /generator/Xcode Extra Generators diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index df434c5..983bf22 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -128,6 +128,7 @@ Variables that Change Behavior /variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE /variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE /variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME + /variable/CMAKE_INSTALL_MESSAGE /variable/CMAKE_INSTALL_PREFIX /variable/CMAKE_LIBRARY_PATH /variable/CMAKE_MFC_FLAG @@ -178,6 +179,7 @@ Variables that Describe the System /variable/MSVC10 /variable/MSVC11 /variable/MSVC12 + /variable/MSVC14 /variable/MSVC60 /variable/MSVC70 /variable/MSVC71 diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 5743ab7..8dfc16a 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -38,7 +38,7 @@ Options For true platform independence, CMake provides a list of commands that can be used on all systems. Run with -E help for the usage information. Commands available are: chdir, compare_files, copy, - copy_directory, copy_if_different, echo, echo_append, environment, + copy_directory, copy_if_different, echo, echo_append, env, environment, make_directory, md5sum, remove, remove_directory, rename, sleep, tar, time, touch, touch_nocreate. In addition, some platform specific commands are available. On Windows: delete_regv, write_regv. On diff --git a/Help/release/dev/FindVTK.rst b/Help/release/dev/FindVTK.rst new file mode 100644 index 0000000..1cc9fc4 --- /dev/null +++ b/Help/release/dev/FindVTK.rst @@ -0,0 +1,6 @@ +FindVTK +------- + +* The :module:`FindVTK` module dropped support for finding VTK 4.0. + It is now a thin-wrapper around ``find_package(VTK ... NO_MODULE)``. + This produces much clearer error messages when VTK is not found. diff --git a/Help/release/dev/cmake-E-env.rst b/Help/release/dev/cmake-E-env.rst new file mode 100644 index 0000000..4bdcd0c --- /dev/null +++ b/Help/release/dev/cmake-E-env.rst @@ -0,0 +1,4 @@ +cmake-E-env +----------- + +* The :manual:`cmake(1)` ``-E`` option learned a new ``env`` command. diff --git a/Help/release/dev/find-module-targets.rst b/Help/release/dev/find-module-targets.rst new file mode 100644 index 0000000..98ea283 --- /dev/null +++ b/Help/release/dev/find-module-targets.rst @@ -0,0 +1,8 @@ +find-module-targets +------------------- + +* The :module:`FindGLUT` module now provides imported targets. + +* The :module:`FindGLEW` module now provides imported targets. + +* The :module:`FindZLIB` module now provides imported targets. diff --git a/Help/release/dev/install-messages.rst b/Help/release/dev/install-messages.rst new file mode 100644 index 0000000..e023ef7 --- /dev/null +++ b/Help/release/dev/install-messages.rst @@ -0,0 +1,8 @@ +install-messages +---------------- + +* The :command:`install` command learned a ``MESSAGE_NEVER`` option + to avoid output during installation. + +* The :variable:`CMAKE_INSTALL_MESSAGE` variable was introduced to + optionally reduce output installation. diff --git a/Help/release/dev/vs14-generator.rst b/Help/release/dev/vs14-generator.rst new file mode 100644 index 0000000..0bda236 --- /dev/null +++ b/Help/release/dev/vs14-generator.rst @@ -0,0 +1,4 @@ +vs14-generator +-------------- + +* A :generator:`Visual Studio 14` generator was added. diff --git a/Help/variable/CMAKE_INSTALL_MESSAGE.rst b/Help/variable/CMAKE_INSTALL_MESSAGE.rst new file mode 100644 index 0000000..304df26 --- /dev/null +++ b/Help/variable/CMAKE_INSTALL_MESSAGE.rst @@ -0,0 +1,30 @@ +CMAKE_INSTALL_MESSAGE +--------------------- + +Specify verbosity of installation script code generated by the +:command:`install` command (using the :command:`file(INSTALL)` command). +For paths that are newly installed or updated, installation +may print lines like:: + + -- Installing: /some/destination/path + +For paths that are already up to date, installation may print +lines like:: + + -- Up-to-date: /some/destination/path + +The ``CMAKE_INSTALL_MESSAGE`` variable may be set to control +which messages are printed: + +``ALWAYS`` + Print both ``Installing`` and ``Up-to-date`` messages. + +``LAZY`` + Print ``Installing`` but not ``Up-to-date`` messages. + +``NEVER`` + Print neither ``Installing`` nor ``Up-to-date`` messages. + +Other values have undefined behavior and may not be diagnosed. + +If this variable is not set, the default behavior is ``ALWAYS``. diff --git a/Help/variable/MSVC14.rst b/Help/variable/MSVC14.rst new file mode 100644 index 0000000..33c782b --- /dev/null +++ b/Help/variable/MSVC14.rst @@ -0,0 +1,6 @@ +MSVC14 +------ + +True when using Microsoft Visual C 14.0 + +Set to true when the compiler is version 14.0 of Microsoft Visual C. diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst index d74114e..ef3b0b5 100644 --- a/Help/variable/MSVC_VERSION.rst +++ b/Help/variable/MSVC_VERSION.rst @@ -3,9 +3,7 @@ MSVC_VERSION The version of Microsoft Visual C/C++ being used if any. -Known version numbers are: - -:: +Known version numbers are:: 1200 = VS 6.0 1300 = VS 7.0 @@ -15,3 +13,4 @@ Known version numbers are: 1600 = VS 10.0 1700 = VS 11.0 1800 = VS 12.0 + 1900 = VS 14.0 diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index dfd4460..0eec4ad 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -383,6 +383,8 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) else() set (_boost_COMPILER "-il") endif() + elseif (MSVC14) + set(_boost_COMPILER "-vc140") elseif (MSVC12) set(_boost_COMPILER "-vc120") elseif (MSVC11) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index d9809ad..9348aa5 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -452,7 +452,17 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") if(CMAKE_GENERATOR MATCHES "Visual Studio") set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") else() - set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC") + # Using cc which is symlink to clang may let NVCC think it is GCC and issue + # unhandled -dumpspecs option to clang. Also in case neither + # CMAKE_C_COMPILER is defined (project does not use C language) nor + # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let + # nvcc use its own default C compiler. + if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER) + get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH) + else() + set(c_compiler_realpath "") + endif() + set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") endif() # Propagate the host flags to the host compiler via -Xcompiler @@ -1422,7 +1432,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options # If -ccbin, --compiler-bindir has been specified, don't do anything. Otherwise add it here. list( FIND nvcc_flags "-ccbin" ccbin_found0 ) list( FIND nvcc_flags "--compiler-bindir" ccbin_found1 ) - if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) + if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER ) list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"") endif() # Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG} diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index f0aac84..58e0d31 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -62,7 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path set(CUDA_make2cmake "@CUDA_make2cmake@") # path set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path set(build_cubin @build_cubin@) # bool -set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool +set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path # We won't actually use these variables for now, but we need to set this, in # order to force this file to be run again if it changes. set(generated_file_path "@generated_file_path@") # path @@ -106,7 +106,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}}) # Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 ) list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 ) -if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) +if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER ) if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN) set(CCBIN -ccbin "${CCBIN}") else() diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake index 497a80c..f42182f 100644 --- a/Modules/FindGLEW.cmake +++ b/Modules/FindGLEW.cmake @@ -4,6 +4,15 @@ # # Find the OpenGL Extension Wrangler Library (GLEW) # +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``, +# if GLEW has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# # This module defines the following variables: # # :: @@ -35,4 +44,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(GLEW REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) +if(GLEW_FOUND AND NOT TARGET GLEW::GLEW) + add_library(GLEW::GLEW UNKNOWN IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") +endif() + mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index be7c0cd..c9f7597 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -2,7 +2,20 @@ # FindGLUT # -------- # -# try to find glut library and include files +# try to find glut library and include files. +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` targets: +# +# ``GLUT::GLUT`` +# Defined if the system has GLUT. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module sets the following variables: # # :: # @@ -42,13 +55,21 @@ if (WIN32) else () if (APPLE) - # These values for Apple could probably do with improvement. - find_path( GLUT_INCLUDE_DIR glut.h - /System/Library/Frameworks/GLUT.framework/Versions/A/Headers - ${OPENGL_LIBRARY_DIR} - ) - set(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") - set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") + find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR}) + find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX") + find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX") + + if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa) + add_library(GLUT::Cocoa UNKNOWN IMPORTED) + # Cocoa should always be a Framework, but we check to make sure. + if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(GLUT::Cocoa PROPERTIES + IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(GLUT::Cocoa PROPERTIES + IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}") + endif() + endif() else () if (BEOS) @@ -66,6 +87,18 @@ else () /usr/openwin/lib ) + if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi) + add_library(GLUT::Xi UNKNOWN IMPORTED) + set_target_properties(GLUT::Xi PROPERTIES + IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}") + endif() + + if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu) + add_library(GLUT::Xmu UNKNOWN IMPORTED) + set_target_properties(GLUT::Xmu PROPERTIES + IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}") + endif() + endif () find_path( GLUT_INCLUDE_DIR GL/glut.h @@ -102,6 +135,34 @@ if (GLUT_FOUND) ${GLUT_cocoa_LIBRARY} ) + if(NOT TARGET GLUT::GLUT) + add_library(GLUT::GLUT UNKNOWN IMPORTED) + set_target_properties(GLUT::GLUT PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIR}") + if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(GLUT::GLUT PROPERTIES + IMPORTED_LOCATION "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(GLUT::GLUT PROPERTIES + IMPORTED_LOCATION "${GLUT_glut_LIBRARY}") + endif() + + if(TARGET GLUT::Xmu) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xmu) + endif() + + if(TARGET GLUT::Xi) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xi) + endif() + + if(TARGET GLUT::Cocoa) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Cocoa) + endif() + endif() + #The following deprecated settings are for backwards compatibility with CMake1.4 set (GLUT_LIBRARY ${GLUT_LIBRARIES}) set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake index 90e4485..86bb6e5 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -33,7 +33,7 @@ find_path(JPEG_INCLUDE_DIR jpeglib.h) -set(JPEG_NAMES ${JPEG_NAMES} jpeg) +set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg) find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index b5eed9a..4d3ed84 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -70,14 +70,15 @@ endfunction() find_path(OpenCL_INCLUDE_DIR NAMES CL/cl.h OpenCL/cl.h - PATHS ENV - "PROGRAMFILES(X86)" - AMDAPPSDKROOT - INTELOCLSDKROOT - NVSDKCOMPUTE_ROOT - CUDA_PATH - ATISTREAMSDKROOT + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV NVSDKCOMPUTE_ROOT + ENV CUDA_PATH + ENV ATISTREAMSDKROOT PATH_SUFFIXES + include OpenCL/common/inc "AMD APP/include") @@ -87,13 +88,13 @@ if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 4) find_library(OpenCL_LIBRARY NAMES OpenCL - PATHS ENV - "PROGRAMFILES(X86)" - AMDAPPSDKROOT - INTELOCLSDKROOT - CUDA_PATH - NVSDKCOMPUTE_ROOT - ATISTREAMSDKROOT + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV CUDA_PATH + ENV NVSDKCOMPUTE_ROOT + ENV ATISTREAMSDKROOT PATH_SUFFIXES "AMD APP/lib/x86" lib/x86 @@ -102,13 +103,13 @@ if(WIN32) elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) find_library(OpenCL_LIBRARY NAMES OpenCL - PATHS ENV - "PROGRAMFILES(X86)" - AMDAPPSDKROOT - INTELOCLSDKROOT - CUDA_PATH - NVSDKCOMPUTE_ROOT - ATISTREAMSDKROOT + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV CUDA_PATH + ENV NVSDKCOMPUTE_ROOT + ENV ATISTREAMSDKROOT PATH_SUFFIXES "AMD APP/lib/x86_64" lib/x86_64 diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 30972ae..935a0ca 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -68,8 +68,11 @@ function(_OPENMP_FLAG_CANDIDATES LANG) set(OMP_FLAG_HP "+Oopenmp") if(WIN32) set(OMP_FLAG_Intel "-Qopenmp") - else() + elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Intel" AND + "${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528") set(OMP_FLAG_Intel "-openmp") + else() + set(OMP_FLAG_Intel "-qopenmp") endif() set(OMP_FLAG_MIPSpro "-mp") set(OMP_FLAG_MSVC "/openmp") diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index c930042..c942c1c 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -518,7 +518,8 @@ set(QT4_INSTALLED_VERSION_TOO_OLD FALSE) set(_QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac) _qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION) -if (QT_QMAKE_EXECUTABLE AND QTVERSION) +if (QT_QMAKE_EXECUTABLE AND + QTVERSION VERSION_GREATER 3 AND QTVERSION VERSION_LESS 5) if (Qt5Core_FOUND) # Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5 diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index bcc7f87..60f48dd 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -10,18 +10,6 @@ # :: # # VTK_FOUND - Set to true when VTK is found. -# VTK_USE_FILE - CMake file to use VTK. -# VTK_MAJOR_VERSION - The VTK major version number. -# VTK_MINOR_VERSION - The VTK minor version number -# (odd non-release). -# VTK_BUILD_VERSION - The VTK patch level -# (meaningless for odd minor). -# VTK_INCLUDE_DIRS - Include directories for VTK -# VTK_LIBRARY_DIRS - Link directories for VTK libraries -# VTK_KITS - List of VTK kits, in CAPS -# (COMMON,IO,) etc. -# VTK_LANGUAGES - List of wrapped languages, in CAPS -# (TCL, PYHTON,) etc. # # The following cache entries must be set by the user to locate VTK: # @@ -43,7 +31,7 @@ # instead. #============================================================================= -# Copyright 2001-2009 Kitware, Inc. +# Copyright 2001-2014 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -55,102 +43,24 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# Assume not found. -set(VTK_FOUND 0) - -# VTK 4.0 did not provide VTKConfig.cmake. -if("${VTK_FIND_VERSION}" VERSION_LESS 4.1) - set(_VTK_40_ALLOW 1) - if(VTK_FIND_VERSION) - set(_VTK_40_ONLY 1) - endif() -endif() - -# Construct consistent error messages for use below. -set(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") -if(_VTK_40_ALLOW) - set(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") -endif() -set(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}") - -# Check whether VTK 4.0 has already been found. -if(_VTK_40_ALLOW AND VTK_DIR) - if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - set(VTK_FOUND 1) - include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings. - endif() -endif() - # Use the Config mode of the find_package() command to find VTKConfig. # If this succeeds (possibly because VTK_DIR is already set), the # command will have already loaded VTKConfig.cmake and set VTK_FOUND. -if(NOT _VTK_40_ONLY AND NOT VTK_FOUND) - find_package(VTK QUIET NO_MODULE) -endif() - -# Special search for VTK 4.0. -if(_VTK_40_ALLOW AND NOT VTK_DIR) - # Old scripts may set these directories in the CMakeCache.txt file. - # They can tell us where to find VTKConfig.cmake. - set(VTK_DIR_SEARCH_LEGACY "") - if(VTK_BINARY_PATH AND USE_BUILT_VTK) - set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH}) - endif() - if(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) - set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} - ${VTK_INSTALL_PATH}/lib/vtk) +if(NOT VTK_FOUND) + set(_VTK_REQUIRED "") + if(VTK_FIND_REQUIRED) + set(_VTK_REQUIRED REQUIRED) endif() - - # Look for UseVTK.cmake in build trees or under <prefix>/include/vtk. - find_path(VTK_DIR - NAMES UseVTK.cmake - PATH_SUFFIXES vtk-4.0 vtk - HINTS ENV VTK_DIR - - PATHS - - # Support legacy cache files. - ${VTK_DIR_SEARCH_LEGACY} - - # Read from the CMakeSetup registry entries. It is likely that - # VTK will have been recently built. - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] - - # Help the user find it if we cannot. - DOC "The ${VTK_DIR_DESCRIPTION}" - ) - - if(VTK_DIR) - if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - set(VTK_FOUND 1) - include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings. - else() - # We found the wrong version. Pretend we did not find it. - set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE) - endif() + set(_VTK_QUIET "") + if(VTK_FIND_QUIETLY) + set(_VTK_QUIET QUIET) endif() + find_package(VTK ${_VTK_REQUIRED} ${_VTK_QUIET} NO_MODULE) + unset(_VTK_REQUIRED) + unset(_VTK_QUIET) endif() -#----------------------------------------------------------------------------- if(VTK_FOUND) # Set USE_VTK_FILE for backward-compatibility. set(USE_VTK_FILE ${VTK_USE_FILE}) -else() - # VTK not found, explain to the user how to specify its location. - if(VTK_FIND_REQUIRED) - message(FATAL_ERROR ${VTK_DIR_MESSAGE}) - else() - if(NOT VTK_FIND_QUIETLY) - message(STATUS ${VTK_DIR_MESSAGE}) - endif() - endif() endif() diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 3a31cf0..90c1499 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -4,7 +4,7 @@ # # Find X11 installation # -# Try to find X11 on UNIX systems. The following values are defined +# Try to find X11 on UNIX systems. The following values are defined # # :: # @@ -12,47 +12,44 @@ # X11_INCLUDE_DIR - include directories to use X11 # X11_LIBRARIES - link against these to use X11 # -# -# -# and also the following more fine grained variables: Include paths: -# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND +# and also the following more fine grained variables: # # :: # -# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND -# X11_X11_INCLUDE_PATH, X11_X11_LIB -# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND -# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND -# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND -# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND -# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND -# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND -# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND -# X11_Xext_LIB, X11_Xext_FOUND -# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND -# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND -# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND -# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND -# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND -# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND -# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND -# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND -# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND -# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND -# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND -# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND -# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND -# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND -# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND -# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND -# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND -# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND -# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND -# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND -# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND -# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND -# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND - +# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND +# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND +# X11_X11_INCLUDE_PATH, X11_X11_LIB +# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND +# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND +# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND +# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND +# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND +# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND +# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND +# X11_Xext_LIB, X11_Xext_FOUND +# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND +# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND +# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND +# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND +# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND +# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND +# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND +# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND +# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND +# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND +# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND +# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND +# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND +# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND +# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND +# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND +# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND +# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND +# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND +# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND +# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND +# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND +# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND #============================================================================= # Copyright 2001-2009 Kitware, Inc. diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 8cc382c..d4a27d5 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -2,9 +2,18 @@ # FindZLIB # -------- # -# Find zlib +# Find the native ZLIB includes and library. # -# Find the native ZLIB includes and library. Once done this will define +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if +# ZLIB has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: # # :: # @@ -12,8 +21,6 @@ # ZLIB_LIBRARIES - List of libraries when using zlib. # ZLIB_FOUND - True if zlib found. # -# -# # :: # # ZLIB_VERSION_STRING - The version of zlib found (x.y.z) @@ -22,7 +29,8 @@ # ZLIB_VERSION_PATCH - The patch version of zlib # ZLIB_VERSION_TWEAK - The tweak version of zlib # -# +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ # # The following variable are provided for backward compatibility # @@ -32,9 +40,10 @@ # ZLIB_MINOR_VERSION - The minor version of zlib # ZLIB_PATCH_VERSION - The patch version of zlib # +# Hints +# ^^^^^ # -# -# An includer may set ZLIB_ROOT to a zlib installation root to tell this +# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this # module where to look. #============================================================================= @@ -104,5 +113,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D if(ZLIB_FOUND) set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) -endif() + if(NOT TARGET ZLIB::ZLIB) + add_library(ZLIB::ZLIB UNKNOWN IMPORTED) + set_target_properties(ZLIB::ZLIB PROPERTIES + IMPORTED_LOCATION "${ZLIB_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") + endif() +endif() diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f83f992..66d300a 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -213,7 +213,6 @@ macro(_test_compiler_hidden_visibility) # Exclude XL here because it misinterprets -fvisibility=hidden even though # the check_cxx_compiler_flag passes - # http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259 if(NOT GCC_TOO_OLD AND NOT _INTEL_TOO_OLD AND NOT WIN32 diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 5c439e9..349cbf5 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -94,6 +94,8 @@ if(MSVC) "${MSVC80_CRT_DIR}/msvcp80.dll" "${MSVC80_CRT_DIR}/msvcr80.dll" ) + else() + set(__install__libs) endif() if(CMAKE_INSTALL_DEBUG_LIBRARIES) @@ -132,6 +134,8 @@ if(MSVC) "${MSVC90_CRT_DIR}/msvcp90.dll" "${MSVC90_CRT_DIR}/msvcr90.dll" ) + else() + set(__install__libs) endif() if(CMAKE_INSTALL_DEBUG_LIBRARIES) @@ -168,6 +172,8 @@ if(MSVC) "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll" "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll" ) + else() + set(__install__libs) endif() if(CMAKE_INSTALL_DEBUG_LIBRARIES) @@ -192,6 +198,10 @@ if(MSVC) MSVCRT_FILES_FOR_VERSION(12) endif() + if(MSVC14) + MSVCRT_FILES_FOR_VERSION(14) + endif() + if(CMAKE_INSTALL_MFC_LIBRARIES) if(MSVC70) set(__install__libs ${__install__libs} @@ -361,6 +371,10 @@ if(MSVC) if(MSVC12) MFC_FILES_FOR_VERSION(12) endif() + + if(MSVC14) + MFC_FILES_FOR_VERSION(14) + endif() endif() foreach(lib diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 5732170..bb6d991 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -85,6 +85,7 @@ if(NOT MSVC_VERSION) set(MSVC10) set(MSVC11) set(MSVC12) + set(MSVC14) set(MSVC60) set(MSVC70) set(MSVC71) @@ -92,7 +93,9 @@ if(NOT MSVC_VERSION) set(MSVC90) set(CMAKE_COMPILER_2005) set(CMAKE_COMPILER_SUPPORTS_PDBTYPE) - if(NOT "${_compiler_version}" VERSION_LESS 18) + if(NOT "${_compiler_version}" VERSION_LESS 19) + set(MSVC14 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 18) set(MSVC12 1) elseif(NOT "${_compiler_version}" VERSION_LESS 17) set(MSVC11 1) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 918e2ec..31ab48d 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -73,7 +73,7 @@ macro(SWIG_MODULE_INITIALIZE name language) set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") set(SWIG_MODULE_${name}_REAL_NAME "${name}") - if (CMAKE_SWIG_FLAGS MATCHES "-noproxy") + if (";${CMAKE_SWIG_FLAGS};" MATCHES ";-noproxy;") set (SWIG_MODULE_${name}_NOPROXY TRUE) endif () if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c3c24fe..3838cb0 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -426,6 +426,8 @@ if (WIN32) cmGlobalVisualStudio11Generator.cxx cmGlobalVisualStudio12Generator.h cmGlobalVisualStudio12Generator.cxx + cmGlobalVisualStudio14Generator.h + cmGlobalVisualStudio14Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmIDEFlagTable.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d259a0c..27405be 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140616) +set(CMake_VERSION_PATCH 20140702) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 91f92c5..9336bed 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -637,8 +637,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( if ( globalGenerator->GetPreinstallTargetName() ) { globalGenerator->FindMakeProgram(this->MakefileMap); - const char* cmakeMakeProgram - = this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM"); + std::string cmakeMakeProgram + = this->MakefileMap->GetSafeDefinition("CMAKE_MAKE_PROGRAM"); std::vector<std::string> buildCommand; globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram, installProjectName, installDirectory, diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 7922c9a..2ec1365 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -605,6 +605,9 @@ void cmCTestBuildHandler::GenerateXMLLaunched(std::ostream& os) typedef std::set<std::string, FragmentCompare> Fragments; Fragments fragments(fragmentCompare); + // only report the first 50 warnings and first 50 errors + int numErrorsAllowed = this->MaxErrors; + int numWarningsAllowed = this->MaxWarnings; // Identify fragments on disk. cmsys::Directory launchDir; launchDir.Load(this->CTestLaunchDir.c_str()); @@ -612,13 +615,15 @@ void cmCTestBuildHandler::GenerateXMLLaunched(std::ostream& os) for(unsigned long i=0; i < n; ++i) { const char* fname = launchDir.GetFile(i); - if(this->IsLaunchedErrorFile(fname)) + if(this->IsLaunchedErrorFile(fname) && numErrorsAllowed) { + numErrorsAllowed--; fragments.insert(this->CTestLaunchDir + "/" + fname); ++this->TotalErrors; } - else if(this->IsLaunchedWarningFile(fname)) + else if(this->IsLaunchedWarningFile(fname) && numWarningsAllowed) { + numWarningsAllowed--; fragments.insert(this->CTestLaunchDir + "/" + fname); ++this->TotalWarnings; } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 09d0ad8..7b50174 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -918,7 +918,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " << res.Name << std::endl); - std::string ofile = testOutputFileName(test); + std::string ofile = this->TestOutputFileName(test); if ( ofile.empty() ) { return; @@ -957,7 +957,7 @@ cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessPurifyTest for : " << res.Name << std::endl); - appendMemTesterOutput(res, test); + this->AppendMemTesterOutput(res, test); } void @@ -967,14 +967,14 @@ cmCTestMemCheckHandler::PostProcessValgrindTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessValgrindTest for : " << res.Name << std::endl); - appendMemTesterOutput(res, test); + this->AppendMemTesterOutput(res, test); } void -cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res, +cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, int test) { - std::string ofile = testOutputFileName(test); + std::string ofile = this->TestOutputFileName(test); if ( ofile.empty() ) { @@ -996,7 +996,7 @@ cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res, } std::string -cmCTestMemCheckHandler::testOutputFileName(int test) +cmCTestMemCheckHandler::TestOutputFileName(int test) { std::string index; cmOStringStream stream; diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 0521a48..20a38bb 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -123,11 +123,11 @@ private: void PostProcessValgrindTest(cmCTestTestResult& res, int test); ///! append MemoryTesterOutputFile to the test log - void appendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, + void AppendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res, int test); ///! generate the output filename for the given test index - std::string testOutputFileName(int test); + std::string TestOutputFileName(int test); }; #endif diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 995f191..6170e92 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -172,12 +172,10 @@ satisfy dependencies. //---------------------------------------------------------------------------- cmComputeLinkDepends -::cmComputeLinkDepends(cmTarget const* target, const std::string& config, - cmTarget const* head) +::cmComputeLinkDepends(cmTarget const* target, const std::string& config) { // Store context information. this->Target = target; - this->HeadTarget = head; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); @@ -294,8 +292,7 @@ cmComputeLinkDepends::AllocateLinkEntry(std::string const& item) } //---------------------------------------------------------------------------- -int cmComputeLinkDepends::AddLinkEntry(int depender_index, - std::string const& item) +int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item) { // Check if the item entry has already been added. std::map<std::string, int>::iterator lei = this->LinkEntryIndex.find(item); @@ -312,7 +309,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index, int index = lei->second; LinkEntry& entry = this->EntryList[index]; entry.Item = item; - entry.Target = this->FindTargetToLink(depender_index, entry.Item); + entry.Target = item.Target; entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' && item.substr(0, 10) != "-framework"); @@ -356,7 +353,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) { // Follow the target dependencies. if(cmTarget::LinkInterface const* iface = - entry.Target->GetLinkInterface(this->Config, this->HeadTarget)) + entry.Target->GetLinkInterface(this->Config, this->Target)) { const bool isIface = entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY; @@ -372,11 +369,11 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) this->FollowSharedDeps(depender_index, iface); // Support for CMP0003. - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator oi = iface->WrongConfigLibraries.begin(); oi != iface->WrongConfigLibraries.end(); ++oi) { - this->CheckWrongConfigItem(depender_index, *oi); + this->CheckWrongConfigItem(*oi); } } } @@ -408,9 +405,9 @@ cmComputeLinkDepends void cmComputeLinkDepends ::QueueSharedDependencies(int depender_index, - std::vector<std::string> const& deps) + std::vector<cmLinkItem> const& deps) { - for(std::vector<std::string>::const_iterator li = deps.begin(); + for(std::vector<cmLinkItem>::const_iterator li = deps.begin(); li != deps.end(); ++li) { SharedDepEntry qe; @@ -434,8 +431,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) // Initialize the item entry. LinkEntry& entry = this->EntryList[lei->second]; entry.Item = dep.Item; - entry.Target = this->FindTargetToLink(dep.DependerIndex, - dep.Item); + entry.Target = dep.Item.Target; // This item was added specifically because it is a dependent // shared library. It may get special treatment @@ -455,7 +451,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) if(entry.Target) { if(cmTarget::LinkInterface const* iface = - entry.Target->GetLinkInterface(this->Config, this->HeadTarget)) + entry.Target->GetLinkInterface(this->Config, this->Target)) { // Follow public and private dependencies transitively. this->FollowSharedDeps(index, iface, true); @@ -474,7 +470,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, cmSystemTools::ExpandListArgument(value, deplist); // Look for entries meant for this configuration. - std::vector<std::string> actual_libs; + std::vector<cmLinkItem> actual_libs; cmTarget::LinkLibraryType llt = cmTarget::GENERAL; bool haveLLT = false; for(std::vector<std::string>::const_iterator di = deplist.begin(); @@ -522,11 +518,13 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, // If the library is meant for this link type then use it. if(llt == cmTarget::GENERAL || llt == this->LinkType) { - actual_libs.push_back(*di); + cmLinkItem item(*di, this->FindTargetToLink(depender_index, *di)); + actual_libs.push_back(item); } else if(this->OldLinkDirMode) { - this->CheckWrongConfigItem(depender_index, *di); + cmLinkItem item(*di, this->FindTargetToLink(depender_index, *di)); + this->CheckWrongConfigItem(item); } // Reset the link type until another explicit type is given. @@ -544,38 +542,38 @@ void cmComputeLinkDepends::AddDirectLinkEntries() { // Add direct link dependencies in this configuration. cmTarget::LinkImplementation const* impl = - this->Target->GetLinkImplementation(this->Config, this->HeadTarget); + this->Target->GetLinkImplementation(this->Config); this->AddLinkEntries(-1, impl->Libraries); - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator wi = impl->WrongConfigLibraries.begin(); wi != impl->WrongConfigLibraries.end(); ++wi) { - this->CheckWrongConfigItem(-1, *wi); + this->CheckWrongConfigItem(*wi); } } //---------------------------------------------------------------------------- void -cmComputeLinkDepends::AddLinkEntries(int depender_index, - std::vector<std::string> const& libs) +cmComputeLinkDepends::AddLinkEntries( + int depender_index, std::vector<cmLinkItem> const& libs) { // Track inferred dependency sets implied by this list. std::map<int, DependSet> dependSets; // Loop over the libraries linked directly by the depender. - for(std::vector<std::string>::const_iterator li = libs.begin(); + for(std::vector<cmLinkItem>::const_iterator li = libs.begin(); li != libs.end(); ++li) { // Skip entries that will resolve to the target getting linked or // are empty. - std::string item = this->Target->CheckCMP0004(*li); + cmLinkItem const& item = *li; if(item == this->Target->GetName() || item.empty()) { continue; } // Add a link entry for this item. - int dependee_index = this->AddLinkEntry(depender_index, item); + int dependee_index = this->AddLinkEntry(*li); // The dependee must come after the depender. if(depender_index >= 0) @@ -625,40 +623,15 @@ cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index, const std::string& name) { // Look for a target in the scope of the depender. - cmMakefile* mf = this->Makefile; + cmTarget const* from = this->Target; if(depender_index >= 0) { if(cmTarget const* depender = this->EntryList[depender_index].Target) { - mf = depender->GetMakefile(); + from = depender; } } - cmTarget const* tgt = mf->FindTargetToUse(name); - - // Skip targets that will not really be linked. This is probably a - // name conflict between an external library and an executable - // within the project. - if(tgt && tgt->GetType() == cmTarget::EXECUTABLE && - !tgt->IsExecutableWithExports()) - { - tgt = 0; - } - - if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY) - { - cmOStringStream e; - e << "Target \"" << this->Target->GetName() << "\" links to " - "OBJECT library \"" << tgt->GetName() << "\" but this is not " - "allowed. " - "One may link only to STATIC or SHARED libraries, or to executables " - "with the ENABLE_EXPORTS property set."; - this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Target->GetBacktrace()); - tgt = 0; - } - - // Return the target found, if any. - return tgt; + return from->FindTargetToLink(name); } //---------------------------------------------------------------------------- @@ -955,7 +928,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) if(cmTarget const* target = this->EntryList[*ni].Target) { if(cmTarget::LinkInterface const* iface = - target->GetLinkInterface(this->Config, this->HeadTarget)) + target->GetLinkInterface(this->Config, this->Target)) { if(iface->Multiplicity > count) { @@ -988,8 +961,7 @@ void cmComputeLinkDepends::DisplayFinalEntries() } //---------------------------------------------------------------------------- -void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index, - std::string const& item) +void cmComputeLinkDepends::CheckWrongConfigItem(cmLinkItem const& item) { if(!this->OldLinkDirMode) { @@ -999,12 +971,8 @@ void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index, // For CMake 2.4 bug-compatibility we need to consider the output // directories of targets linked in another configuration as link // directories. - if(cmTarget const* tgt - = this->FindTargetToLink(depender_index, item)) + if(item.Target && !item.Target->IsImported()) { - if(!tgt->IsImported()) - { - this->OldWrongConfigItems.insert(tgt); - } + this->OldWrongConfigItems.insert(item.Target); } } diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 13fc993..3207ecb 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -32,8 +32,7 @@ class cmake; class cmComputeLinkDepends { public: - cmComputeLinkDepends(cmTarget const* target, const std::string& config, - cmTarget const* head); + cmComputeLinkDepends(cmTarget const* target, const std::string& config); ~cmComputeLinkDepends(); // Basic information about each link item. @@ -60,7 +59,6 @@ private: // Context information. cmTarget const* Target; - cmTarget const* HeadTarget; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; cmGlobalGenerator const* GlobalGenerator; @@ -79,11 +77,11 @@ private: std::map<std::string, int>::iterator AllocateLinkEntry(std::string const& item); - int AddLinkEntry(int depender_index, std::string const& item); + int AddLinkEntry(cmLinkItem const& item); void AddVarLinkEntries(int depender_index, const char* value); void AddDirectLinkEntries(); void AddLinkEntries(int depender_index, - std::vector<std::string> const& libs); + std::vector<cmLinkItem> const& libs); cmTarget const* FindTargetToLink(int depender_index, const std::string& name); @@ -105,7 +103,7 @@ private: // of the interface. struct SharedDepEntry { - std::string Item; + cmLinkItem Item; int DependerIndex; }; std::queue<SharedDepEntry> SharedDepQueue; @@ -114,7 +112,7 @@ private: cmTarget::LinkInterface const* iface, bool follow_interface = false); void QueueSharedDependencies(int depender_index, - std::vector<std::string> const& deps); + std::vector<cmLinkItem> const& deps); void HandleSharedDependency(SharedDepEntry const& dep); // Dependency inferral for each link item. @@ -165,7 +163,7 @@ private: // Compatibility help. bool OldLinkDirMode; - void CheckWrongConfigItem(int depender_index, std::string const& item); + void CheckWrongConfigItem(cmLinkItem const& item); std::set<cmTarget const*> OldWrongConfigItems; }; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 0ce04a5..e1852a3 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -239,12 +239,10 @@ because this need be done only for shared libraries without soname-s. //---------------------------------------------------------------------------- cmComputeLinkInformation -::cmComputeLinkInformation(cmTarget const* target, const std::string& config, - cmTarget const* headTarget) +::cmComputeLinkInformation(cmTarget const* target, const std::string& config) { // Store context information. this->Target = target; - this->HeadTarget = headTarget; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); @@ -267,7 +265,7 @@ cmComputeLinkInformation this->OrderDependentRPath = 0; // Get the language used for linking this target. - this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget); + this->LinkLanguage = this->Target->GetLinkerLanguage(config); if(this->LinkLanguage.empty()) { // The Compute method will do nothing, so skip the rest of the @@ -505,8 +503,7 @@ bool cmComputeLinkInformation::Compute() } // Compute the ordered link line items. - cmComputeLinkDepends cld(this->Target, this->Config, - this->HeadTarget); + cmComputeLinkDepends cld(this->Target, this->Config); cld.SetOldLinkDirMode(this->OldLinkDirMode); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); @@ -572,8 +569,7 @@ bool cmComputeLinkInformation::Compute() void cmComputeLinkInformation::AddImplicitLinkInfo() { // The link closure lists all languages whose implicit info is needed. - cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config, - this->HeadTarget); + cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config); for(std::vector<std::string>::const_iterator li = lc->Languages.begin(); li != lc->Languages.end(); ++li) { @@ -1972,7 +1968,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, // present. This is done even when skipping rpath support. { cmTarget::LinkClosure const* lc = - this->Target->GetLinkClosure(this->Config, this->HeadTarget); + this->Target->GetLinkClosure(this->Config); for(std::vector<std::string>::const_iterator li = lc->Languages.begin(); li != lc->Languages.end(); ++li) { diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index e345fe2..e5d674a 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -29,8 +29,7 @@ class cmOrderDirectories; class cmComputeLinkInformation { public: - cmComputeLinkInformation(cmTarget const* target, const std::string& config, - cmTarget const* headTarget); + cmComputeLinkInformation(cmTarget const* target, const std::string& config); ~cmComputeLinkInformation(); bool Compute(); @@ -75,7 +74,6 @@ private: // Context information. cmTarget const* Target; - cmTarget const* HeadTarget; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; cmGlobalGenerator* GlobalGenerator; diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index f28217f..3929af4 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -249,20 +249,21 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) const_cast<cmTarget*>(depender)->AddUtility(objLib); } } - std::vector<std::string> tlibs; - depender->GetDirectLinkLibraries(*it, tlibs, depender); + + cmTarget::LinkImplementation const* impl = + depender->GetLinkImplementation(*it); // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::vector<std::string>::const_iterator lib = tlibs.begin(); - lib != tlibs.end(); ++lib) + for(std::vector<cmLinkItem>::const_iterator + lib = impl->Libraries.begin(); + lib != impl->Libraries.end(); ++lib) { // Don't emit the same library twice for this target. if(emitted.insert(*lib).second) { this->AddTargetDepend(depender_index, *lib, true); - this->AddInterfaceDepends(depender_index, *lib, - true, emitted); + this->AddInterfaceDepends(depender_index, *lib, emitted); } } } @@ -270,11 +271,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set<std::string> const& tutils = depender->GetUtilities(); + std::set<cmLinkItem> const& tutils = depender->GetUtilityItems(); std::set<std::string> emitted; // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::set<std::string>::const_iterator util = tutils.begin(); + for(std::set<cmLinkItem>::const_iterator util = tutils.begin(); util != tutils.end(); ++util) { // Don't emit the same utility twice for this target. @@ -296,7 +297,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(cmTarget::LinkInterface const* iface = dependee->GetLinkInterface(config, depender)) { - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator lib = iface->Libraries.begin(); lib != iface->Libraries.end(); ++lib) { @@ -304,8 +305,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(emitted.insert(*lib).second) { this->AddTargetDepend(depender_index, *lib, true); - this->AddInterfaceDepends(depender_index, *lib, - true, emitted); + this->AddInterfaceDepends(depender_index, *lib, emitted); } } } @@ -313,17 +313,15 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - const std::string& dependee_name, - bool linking, + cmLinkItem const& dependee_name, std::set<std::string> &emitted) { cmTarget const* depender = this->Targets[depender_index]; - cmTarget const* dependee = - depender->GetMakefile()->FindTargetToUse(dependee_name); + cmTarget const* dependee = dependee_name.Target; // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable // within the project. - if(linking && dependee && + if(dependee && dependee->GetType() == cmTarget::EXECUTABLE && !dependee->IsExecutableWithExports()) { @@ -347,16 +345,15 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, } //---------------------------------------------------------------------------- -void cmComputeTargetDepends::AddTargetDepend(int depender_index, - const std::string& dependee_name, - bool linking) +void cmComputeTargetDepends::AddTargetDepend( + int depender_index, cmLinkItem const& dependee_name, + bool linking) { // Get the depender. cmTarget const* depender = this->Targets[depender_index]; // Check the target's makefile first. - cmTarget const* dependee = - depender->GetMakefile()->FindTargetToUse(dependee_name); + cmTarget const* dependee = dependee_name.Target; if(!dependee && !linking && (depender->GetType() != cmTarget::GLOBAL_TARGET)) @@ -424,12 +421,11 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, if(dependee->IsImported()) { // Skip imported targets but follow their utility dependencies. - std::set<std::string> const& utils = dependee->GetUtilities(); - for(std::set<std::string>::const_iterator i = utils.begin(); + std::set<cmLinkItem> const& utils = dependee->GetUtilityItems(); + for(std::set<cmLinkItem>::const_iterator i = utils.begin(); i != utils.end(); ++i) { - if(cmTarget const* transitive_dependee = - dependee->GetMakefile()->FindTargetToUse(*i)) + if(cmTarget const* transitive_dependee = i->Target) { this->AddTargetDepend(depender_index, transitive_dependee, false); } diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 7553816..902f342 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -20,6 +20,7 @@ class cmComputeComponentGraph; class cmGlobalGenerator; +class cmLinkItem; class cmTarget; class cmTargetDependSet; @@ -46,14 +47,14 @@ private: void CollectDepends(); void CollectTargetDepends(int depender_index); void AddTargetDepend(int depender_index, - const std::string& dependee_name, + cmLinkItem const& dependee_name, bool linking); void AddTargetDepend(int depender_index, cmTarget const* dependee, bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(int depender_index, - const std::string& dependee_name, - bool linking, std::set<std::string> &emitted); + cmLinkItem const& dependee_name, + std::set<std::string> &emitted); void AddInterfaceDepends(int depender_index, cmTarget const* dependee, const std::string& config, std::set<std::string> &emitted); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 79cb560..f06971d 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -765,7 +765,11 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, const char* compilerId) { /* - gnu: + gnu >= 4.9: + A mod file is an ascii file compressed with gzip. + Compiling twice produces identical modules. + + gnu < 4.9: A mod file is an ascii file. <bar.mod> FORTRAN module created from /path/to/foo.f90 on Sun Dec 30 22:47:58 2007 @@ -821,21 +825,30 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, */ if (strcmp(compilerId, "GNU") == 0 ) { - const char seq[1] = {'\n'}; - const int seqlen = 1; - - if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + // GNU Fortran 4.9 and later compress .mod files with gzip + // but also do not include a date so we can fall through to + // compare them without skipping any prefix. + unsigned char hdr[2]; + bool okay = finModFile.read(reinterpret_cast<char*>(hdr), 2)? true:false; + finModFile.seekg(0); + if(!(okay && hdr[0] == 0x1f && hdr[1] == 0x8b)) { - // The module is of unexpected format. Assume it is different. - std::cerr << compilerId << " fortran module " << modFile - << " has unexpected format." << std::endl; - return true; - } + const char seq[1] = {'\n'}; + const int seqlen = 1; - if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) - { - // The stamp must differ if the sequence is not contained. - return true; + if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + { + // The module is of unexpected format. Assume it is different. + std::cerr << compilerId << " fortran module " << modFile + << " has unexpected format." << std::endl; + return true; + } + + if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) + { + // The stamp must differ if the sequence is not contained. + return true; + } } } else if(strcmp(compilerId, "Intel") == 0) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9f5eee5..1f39d7a 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -865,15 +865,16 @@ cmExportFileGenerator } //---------------------------------------------------------------------------- +template <typename T> void cmExportFileGenerator ::SetImportLinkProperty(std::string const& suffix, cmTarget* target, const std::string& propName, - std::vector<std::string> const& entries, + std::vector<T> const& entries, ImportPropertyMap& properties, std::vector<std::string>& missingTargets - ) + ) { // Skip the property if there are no entries. if(entries.empty()) @@ -884,7 +885,7 @@ cmExportFileGenerator // Construct the property value. std::string link_entries; const char* sep = ""; - for(std::vector<std::string>::const_iterator li = entries.begin(); + for(typename std::vector<T>::const_iterator li = entries.begin(); li != entries.end(); ++li) { // Separate this from the previous entry. @@ -902,7 +903,6 @@ cmExportFileGenerator properties[prop] = link_entries; } - //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, const std::string& config) diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index abd8ad5..919924e 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -95,9 +95,11 @@ protected: std::string const& suffix, cmTarget* target, ImportPropertyMap& properties, std::vector<std::string>& missingTargets); + + template <typename T> void SetImportLinkProperty(std::string const& suffix, cmTarget* target, const std::string& propName, - std::vector<std::string> const& entries, + std::vector<T> const& entries, ImportPropertyMap& properties, std::vector<std::string>& missingTargets); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 6f76dc4..56a6edb 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -574,7 +574,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, } } - const char* buildType = makefile->GetDefinition("CMAKE_BUILD_TYPE"); + std::string buildType = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::string location; if ( target->GetType()==cmTarget::OBJECT_LIBRARY) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index e23551e..1beb3fd 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -968,7 +968,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const continue; } std::vector<std::string> includeDirs; - const char *config = mf->GetDefinition("CMAKE_BUILD_TYPE"); + std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); (*it)->GetIncludeDirectories(includeDirs, l->second, "C", config); this->AppendIncludeDirectories(fout, includeDirs, emmited); } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 655f3ba..61c6eb3 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1613,7 +1613,8 @@ bool cmFileCopier::InstallDirectory(const char* source, MatchProperties const& match_properties) { // Inform the user about this directory installation. - this->ReportCopy(destination, TypeDir, true); + this->ReportCopy(destination, TypeDir, + !cmSystemTools::FileIsDirectory(destination)); // Make sure the destination directory exists. if(!cmSystemTools::MakeDirectory(destination)) @@ -1704,6 +1705,9 @@ struct cmFileInstaller: public cmFileCopier cmFileCopier(command, "INSTALL"), InstallType(cmInstallType_FILES), Optional(false), + MessageAlways(false), + MessageLazy(false), + MessageNever(false), DestDirLength(0) { // Installation does not use source permissions by default. @@ -1725,6 +1729,9 @@ struct cmFileInstaller: public cmFileCopier protected: cmInstallType InstallType; bool Optional; + bool MessageAlways; + bool MessageLazy; + bool MessageNever; int DestDirLength; std::string Rename; @@ -1740,9 +1747,12 @@ protected: virtual void ReportCopy(const char* toFile, Type type, bool copy) { - std::string message = (copy? "Installing: " : "Up-to-date: "); - message += toFile; - this->Makefile->DisplayStatus(message.c_str(), -1); + if(!this->MessageNever && (copy || !this->MessageLazy)) + { + std::string message = (copy? "Installing: " : "Up-to-date: "); + message += toFile; + this->Makefile->DisplayStatus(message.c_str(), -1); + } if(type != TypeDir) { // Add the file to the manifest. @@ -1828,6 +1838,16 @@ bool cmFileInstaller::Parse(std::vector<std::string> const& args) return false; } + if(((this->MessageAlways?1:0) + + (this->MessageLazy?1:0) + + (this->MessageNever?1:0)) > 1) + { + this->FileCommand->SetError("INSTALL options MESSAGE_ALWAYS, " + "MESSAGE_LAZY, and MESSAGE_NEVER " + "are mutually exclusive."); + return false; + } + return true; } @@ -1879,6 +1899,42 @@ bool cmFileInstaller::CheckKeyword(std::string const& arg) this->Optional = true; } } + else if(arg == "MESSAGE_ALWAYS") + { + if(this->CurrentMatchRule) + { + this->NotAfterMatch(arg); + } + else + { + this->Doing = DoingNone; + this->MessageAlways = true; + } + } + else if(arg == "MESSAGE_LAZY") + { + if(this->CurrentMatchRule) + { + this->NotAfterMatch(arg); + } + else + { + this->Doing = DoingNone; + this->MessageLazy = true; + } + } + else if(arg == "MESSAGE_NEVER") + { + if(this->CurrentMatchRule) + { + this->NotAfterMatch(arg); + } + else + { + this->Doing = DoingNone; + this->MessageNever = true; + } + } else if(arg == "PERMISSIONS") { if(this->CurrentMatchRule) @@ -2057,23 +2113,26 @@ bool cmFileInstaller::HandleInstallDestination() this->DestDirLength = int(sdestdir.size()); } - if ( !cmSystemTools::FileExists(destination.c_str()) ) + if(this->InstallType != cmInstallType_DIRECTORY) { - if ( !cmSystemTools::MakeDirectory(destination.c_str()) ) + if ( !cmSystemTools::FileExists(destination.c_str()) ) { - std::string errstring = "cannot create directory: " + destination + + if ( !cmSystemTools::MakeDirectory(destination.c_str()) ) + { + std::string errstring = "cannot create directory: " + destination + ". Maybe need administrative privileges."; + this->FileCommand->SetError(errstring); + return false; + } + } + if ( !cmSystemTools::FileIsDirectory(destination.c_str()) ) + { + std::string errstring = "INSTALL destination: " + destination + + " is not a directory."; this->FileCommand->SetError(errstring); return false; } } - if ( !cmSystemTools::FileIsDirectory(destination.c_str()) ) - { - std::string errstring = "INSTALL destination: " + destination + - " is not a directory."; - this->FileCommand->SetError(errstring); - return false; - } return true; } diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 7dcb335..c925869 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -799,7 +799,8 @@ static const char* targetPropertyTransitiveWhitelist[] = { #undef TRANSITIVE_PROPERTY_NAME -std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, +std::string getLinkedTargetsContent( + std::vector<cmTarget const*> &targets, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, @@ -810,7 +811,7 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, std::string sep; std::string depString; - for (std::vector<cmTarget*>::const_iterator + for (std::vector<cmTarget const*>::const_iterator it = targets.begin(); it != targets.end(); ++it) { @@ -827,7 +828,7 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, sep = ";"; } cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depString); - std::string linkedTargetsContent = cge->Evaluate(context->Makefile, + std::string linkedTargetsContent = cge->Evaluate(target->GetMakefile(), context->Config, context->Quiet, headTarget, @@ -840,21 +841,21 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, return linkedTargetsContent; } -std::string getLinkedTargetsContent(const std::vector<std::string> &libraries, +std::string getLinkedTargetsContent(std::vector<cmLinkItem> const &libraries, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, cmGeneratorExpressionDAGChecker *dagChecker, const std::string &interfacePropertyName) { - std::vector<cmTarget*> tgts; - for (std::vector<std::string>::const_iterator + std::vector<cmTarget const*> tgts; + for (std::vector<cmLinkItem>::const_iterator it = libraries.begin(); it != libraries.end(); ++it) { - if (cmTarget *tgt = context->Makefile->FindTargetToUse(*it)) + if (it->Target) { - tgts.push_back(tgt); + tgts.push_back(it->Target); } } return getLinkedTargetsContent(tgts, target, headTarget, context, @@ -1082,7 +1083,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmStrCmp(propertyName)) != transEnd) { - std::vector<cmTarget*> tgts; + std::vector<cmTarget const*> tgts; target->GetTransitivePropertyTargets(context->Config, headTarget, tgts); if (!tgts.empty()) @@ -1098,8 +1099,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmStrCmp(interfacePropertyName)) != transEnd) { const cmTarget::LinkImplementation *impl - = target->GetLinkImplementationLibraries(context->Config, - headTarget); + = target->GetLinkImplementationLibraries(context->Config); if(impl) { linkedTargetsContent = diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a7576ed..fd82d17 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -252,7 +252,7 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const return 0; } -static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, +static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt, const std::string& config, cmTarget *headTarget, cmGeneratorExpressionDAGChecker *dagChecker, @@ -449,7 +449,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, if (iter == this->SystemIncludesCache.end()) { cmTarget::LinkImplementation const* impl - = this->Target->GetLinkImplementation(config, this->Target); + = this->Target->GetLinkImplementation(config); if(!impl) { return false; @@ -474,11 +474,11 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, &dagChecker), result); } - std::set<cmTarget*> uniqueDeps; - for(std::vector<std::string>::const_iterator li = impl->Libraries.begin(); + std::set<cmTarget const*> uniqueDeps; + for(std::vector<cmLinkItem>::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { - cmTarget* tgt = this->Makefile->FindTargetToUse(*li); + cmTarget const* tgt = li->Target; if (!tgt) { continue; @@ -489,10 +489,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, handleSystemIncludesDep(this->Makefile, tgt, config, this->Target, &dagChecker, result, excludeImported); - std::vector<cmTarget*> deps; + std::vector<cmTarget const*> deps; tgt->GetTransitivePropertyTargets(config, this->Target, deps); - for(std::vector<cmTarget*>::const_iterator di = deps.begin(); + for(std::vector<cmTarget const*>::const_iterator di = deps.begin(); di != deps.end(); ++di) { if (uniqueDeps.insert(*di).second) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 0facfeb..09ee128 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -151,11 +151,6 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, ++i) { arguments += " " + EncodeIdent(EncodePath(*i), 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( EncodePath(*i) ); } // Write implicit dependencies. @@ -280,6 +275,13 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command, cmNinjaDeps(), orderOnly, vars); + + //we need to track every dependency that comes in, since we are trying + //to find dependencies that are side effects of build commands + for(cmNinjaDeps::const_iterator i = deps.begin(); i != deps.end(); ++i) + { + this->CombinedCustomCommandExplicitDependencies.insert( EncodePath(*i) ); + } } void @@ -1015,43 +1017,33 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) //to keep this data around this->CombinedBuildOutputs.clear(); - //now we difference with CombinedBuildExplicitDependencies to find + //now we difference with CombinedCustomCommandExplicitDependencies to find //the list of items we know nothing about. - //We have encoded all the paths in CombinedBuildExplicitDependencies + //We have encoded all the paths in CombinedCustomCommandExplicitDependencies //and knownDependencies so no matter if unix or windows paths they //should all match now. std::vector<std::string> unkownExplicitDepends; - this->CombinedBuildExplicitDependencies.erase("all"); + this->CombinedCustomCommandExplicitDependencies.erase("all"); - std::set_difference(this->CombinedBuildExplicitDependencies.begin(), - this->CombinedBuildExplicitDependencies.end(), + std::set_difference(this->CombinedCustomCommandExplicitDependencies.begin(), + this->CombinedCustomCommandExplicitDependencies.end(), knownDependencies.begin(), knownDependencies.end(), std::back_inserter(unkownExplicitDepends)); - std::string const rootBuildDirectory = - this->GetCMakeInstance()->GetHomeOutputDirectory(); for (std::vector<std::string>::const_iterator i = unkownExplicitDepends.begin(); i != unkownExplicitDepends.end(); ++i) { - //verify the file is in the build directory - std::string const absDepPath = cmSystemTools::CollapseFullPath( - i->c_str(), rootBuildDirectory.c_str()); - bool const inBuildDir = cmSystemTools::IsSubDirectory(absDepPath.c_str(), - rootBuildDirectory.c_str()); - if(inBuildDir) - { - cmNinjaDeps deps(1,*i); - this->WritePhonyBuild(os, - "", - deps, - deps); - } - } + cmNinjaDeps deps(1,*i); + this->WritePhonyBuild(os, + "", + deps, + deps); + } } void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index f2643af..ff110d7 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -363,10 +363,11 @@ private: /// The set of custom command outputs we have seen. std::set<std::string> CustomCommandOutputs; - //The combined explicit dependencies of all build commands that the global - //generator has issued. When combined with CombinedBuildOutputs it allows - //us to detect the set of explicit dependencies that have - std::set<std::string> CombinedBuildExplicitDependencies; + /// The combined explicit dependencies of custom build commands + std::set<std::string> CombinedCustomCommandExplicitDependencies; + + /// When combined with CombinedCustomCommandExplicitDependencies it allows + /// us to detect the set of explicit dependencies that have std::set<std::string> CombinedBuildOutputs; /// The mapping from source file to assumed dependencies. diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx new file mode 100644 index 0000000..9bde0ad --- /dev/null +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -0,0 +1,116 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2014 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#include "cmGlobalVisualStudio14Generator.h" +#include "cmLocalVisualStudio10Generator.h" +#include "cmMakefile.h" + +static const char vs14generatorName[] = "Visual Studio 14"; + +class cmGlobalVisualStudio14Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& genName) const + { + if(strncmp(genName.c_str(), vs14generatorName, + sizeof(vs14generatorName) - 1) != 0) + { + return 0; + } + const char* p = genName.c_str() + sizeof(vs14generatorName) - 1; + if(!*p) + { + return new cmGlobalVisualStudio14Generator( + genName, "", ""); + } + if(*p++ != ' ') + { return 0; } + if(strcmp(p, "Win64") == 0) + { + return new cmGlobalVisualStudio14Generator( + genName, "x64", "CMAKE_FORCE_WIN64"); + } + if(strcmp(p, "ARM") == 0) + { + return new cmGlobalVisualStudio14Generator( + genName, "ARM", ""); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const + { + entry.Name = vs14generatorName; + entry.Brief = "Generates Visual Studio 14 project files."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const + { + names.push_back(vs14generatorName); + names.push_back(vs14generatorName + std::string(" ARM")); + names.push_back(vs14generatorName + std::string(" Win64")); + } +}; + +//---------------------------------------------------------------------------- +cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() +{ + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) + : cmGlobalVisualStudio12Generator(name, platformName, + additionalPlatformDefinition) +{ + std::string vc14Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\14.0\\Setup\\VC;" + "ProductDir", vc14Express, cmSystemTools::KeyWOW64_32); + this->DefaultPlatformToolset = "v140"; +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio14Generator::MatchesGeneratorName( + const std::string& name) const +{ + return name == this->GetName(); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout) +{ + // Visual Studio 14 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) + { + fout << "# Visual Studio Express 14 for Windows Desktop\n"; + } + else + { + fout << "# Visual Studio 14\n"; + } +} + +//---------------------------------------------------------------------------- +cmLocalGenerator *cmGlobalVisualStudio14Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio10Generator* lg = + new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14); + lg->SetPlatformName(this->GetPlatformName()); + lg->SetGlobalGenerator(this); + return lg; +} diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h new file mode 100644 index 0000000..7074119 --- /dev/null +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -0,0 +1,44 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2014 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#ifndef cmGlobalVisualStudio14Generator_h +#define cmGlobalVisualStudio14Generator_h + +#include "cmGlobalVisualStudio12Generator.h" + + +/** \class cmGlobalVisualStudio14Generator */ +class cmGlobalVisualStudio14Generator: + public cmGlobalVisualStudio12Generator +{ +public: + cmGlobalVisualStudio14Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); + + virtual bool MatchesGeneratorName(const std::string& name) const; + + virtual void WriteSLNHeader(std::ostream& fout); + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** TODO: VS 14 user macro support. */ + virtual std::string GetUserMacrosDirectory() { return ""; } + + virtual const char* GetToolsVersion() { return "14.0"; } +protected: + virtual const char* GetIDEVersion() { return "14.0"; } +private: + class Factory; +}; +#endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 29a5955..9a36df5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1255,7 +1255,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) // If the language is compiled as a source trust Xcode to link with it. cmTarget::LinkImplementation const* impl = - cmtarget.GetLinkImplementation("NOCONFIG", &cmtarget); + cmtarget.GetLinkImplementation("NOCONFIG"); for(std::vector<std::string>::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) { diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 0041122..ec500d9 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -25,9 +25,12 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target, const cmInstallCommandArguments& args, bool impLib, bool forceOpt = false) { + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(target.GetMakefile()); return new cmInstallTargetGenerator(target, args.GetDestination().c_str(), impLib, args.GetPermissions().c_str(), args.GetConfigurations(), args.GetComponent().c_str(), + message, args.GetOptional() || forceOpt); } @@ -36,10 +39,13 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator( const std::vector<std::string>& absFiles, const cmInstallCommandArguments& args, bool programs) { + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(mf); return new cmInstallFilesGenerator(mf, absFiles, args.GetDestination().c_str(), programs, args.GetPermissions().c_str(), args.GetConfigurations(), args.GetComponent().c_str(), + message, args.GetRename().c_str(), args.GetOptional()); } @@ -911,6 +917,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) Doing doing = DoingDirs; bool in_match_mode = false; bool optional = false; + bool message_never = false; std::vector<std::string> dirs; const char* destination = 0; std::string permissions_file; @@ -949,6 +956,21 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) optional = true; doing = DoingNone; } + else if(args[i] == "MESSAGE_NEVER") + { + if(in_match_mode) + { + cmOStringStream e; + e << args[0] << " does not allow \"" + << args[i] << "\" after PATTERN or REGEX."; + this->SetError(e.str()); + return false; + } + + // Mark the rule as quiet. + message_never = true; + doing = DoingNone; + } else if(args[i] == "PATTERN") { // Switch to a new pattern match rule. @@ -1208,6 +1230,9 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) return false; } + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile, message_never); + // Create the directory install generator. this->Makefile->AddInstallGenerator( new cmInstallDirectoryGenerator(dirs, destination, @@ -1215,6 +1240,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) permissions_dir.c_str(), configurations, component.c_str(), + message, literal_args.c_str(), optional)); @@ -1333,13 +1359,16 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) } } + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile); + // Create the export install generator. cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), - ica.GetComponent().c_str(), fname.c_str(), + ica.GetComponent().c_str(), message, fname.c_str(), name_space.GetCString(), exportOld.IsEnabled(), this->Makefile); this->Makefile->AddInstallGenerator(exportGenerator); diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index ddf7d08..8c13bab 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -21,9 +21,11 @@ cmInstallDirectoryGenerator const char* dir_permissions, std::vector<std::string> const& configurations, const char* component, + MessageLevel message, const char* literal_args, bool optional): - cmInstallGenerator(dest, configurations, component), Directories(dirs), + cmInstallGenerator(dest, configurations, component, message), + Directories(dirs), FilePermissions(file_permissions), DirPermissions(dir_permissions), LiteralArguments(literal_args), Optional(optional) { diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index d76ef3c..165ab91 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -26,6 +26,7 @@ public: const char* dir_permissions, std::vector<std::string> const& configurations, const char* component, + MessageLevel message, const char* literal_args, bool optional = false); virtual ~cmInstallDirectoryGenerator(); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 9a17052..ddfd6c5 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -32,10 +32,11 @@ cmInstallExportGenerator::cmInstallExportGenerator( const char* file_permissions, std::vector<std::string> const& configurations, const char* component, + MessageLevel message, const char* filename, const char* name_space, bool exportOld, cmMakefile* mf) - :cmInstallGenerator(destination, configurations, component) + :cmInstallGenerator(destination, configurations, component, message) ,ExportSet(exportSet) ,FilePermissions(file_permissions) ,FileName(filename) diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 37b5593..eb8c28b 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -30,6 +30,7 @@ public: const char* dest, const char* file_permissions, const std::vector<std::string>& configurations, const char* component, + MessageLevel message, const char* filename, const char* name_space, bool exportOld, cmMakefile* mf); ~cmInstallExportGenerator(); diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 7eabbef..f106e1a 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -132,11 +132,13 @@ void cmInstallFilesCommand::CreateInstallGenerator() const std::string no_component = this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); std::vector<std::string> no_configurations; + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile); this->Makefile->AddInstallGenerator( new cmInstallFilesGenerator(this->Makefile, this->Files, destination.c_str(), false, no_permissions, no_configurations, - no_component.c_str(), no_rename)); + no_component.c_str(), message, no_rename)); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index b2be82e..91b102a 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -23,9 +23,10 @@ cmInstallFilesGenerator const char* file_permissions, std::vector<std::string> const& configurations, const char* component, + MessageLevel message, const char* rename, bool optional): - cmInstallGenerator(dest, configurations, component), + cmInstallGenerator(dest, configurations, component, message), Makefile(mf), Files(files), Programs(programs), FilePermissions(file_permissions), diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 23bf935..0dbd712 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -28,6 +28,7 @@ public: const char* file_permissions, std::vector<std::string> const& configurations, const char* component, + MessageLevel message, const char* rename, bool optional = false); virtual ~cmInstallFilesGenerator(); diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 9370e48..b261cbf 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -11,16 +11,19 @@ ============================================================================*/ #include "cmInstallGenerator.h" +#include "cmMakefile.h" #include "cmSystemTools.h" //---------------------------------------------------------------------------- cmInstallGenerator ::cmInstallGenerator(const char* destination, std::vector<std::string> const& configurations, - const char* component): + const char* component, + MessageLevel message): cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations), Destination(destination? destination:""), - Component(component? component:"") + Component(component? component:""), + Message(message) { } @@ -96,6 +99,13 @@ void cmInstallGenerator { os << " OPTIONAL"; } + switch(this->Message) + { + case MessageDefault: break; + case MessageAlways: os << " MESSAGE_ALWAYS"; break; + case MessageLazy: os << " MESSAGE_LAZY"; break; + case MessageNever: os << " MESSAGE_NEVER"; break; + } if(permissions_file && *permissions_file) { os << " PERMISSIONS" << permissions_file; @@ -180,3 +190,27 @@ std::string cmInstallGenerator::GetInstallDestination() const result += this->Destination; return result; } + +//---------------------------------------------------------------------------- +cmInstallGenerator::MessageLevel +cmInstallGenerator::SelectMessageLevel(cmMakefile* mf, bool never) +{ + if(never) + { + return MessageNever; + } + std::string m = mf->GetSafeDefinition("CMAKE_INSTALL_MESSAGE"); + if(m == "ALWAYS") + { + return MessageAlways; + } + if(m == "LAZY") + { + return MessageLazy; + } + if(m == "NEVER") + { + return MessageNever; + } + return MessageDefault; +} diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index c72e9e9..38aac91 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -16,6 +16,7 @@ #include "cmScriptGenerator.h" class cmLocalGenerator; +class cmMakefile; /** \class cmInstallGenerator * \brief Support class for generating install scripts. @@ -24,9 +25,18 @@ class cmLocalGenerator; class cmInstallGenerator: public cmScriptGenerator { public: + enum MessageLevel + { + MessageDefault, + MessageAlways, + MessageLazy, + MessageNever + }; + cmInstallGenerator(const char* destination, std::vector<std::string> const& configurations, - const char* component); + const char* component, + MessageLevel message); virtual ~cmInstallGenerator(); void AddInstallRule( @@ -50,6 +60,9 @@ public: /** Test if this generator installs something for a given configuration. */ bool InstallsForConfig(const std::string& config); + /** Select message level from CMAKE_INSTALL_MESSAGE or 'never'. */ + static MessageLevel SelectMessageLevel(cmMakefile* mf, bool never = false); + protected: virtual void GenerateScript(std::ostream& os); @@ -58,6 +71,7 @@ protected: // Information shared by most generator types. std::string Destination; std::string Component; + MessageLevel Message; }; #endif diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 597f7ee..0405769 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -93,11 +93,13 @@ void cmInstallProgramsCommand::FinalPass() std::string no_component = this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); std::vector<std::string> no_configurations; + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile); this->Makefile->AddInstallGenerator( new cmInstallFilesGenerator(this->Makefile, this->Files, destination.c_str(), true, no_permissions, no_configurations, - no_component.c_str(), no_rename)); + no_component.c_str(), message, no_rename)); } /** diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 1ecf021..933aa07 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -15,7 +15,7 @@ cmInstallScriptGenerator ::cmInstallScriptGenerator(const char* script, bool code, const char* component) : - cmInstallGenerator(0, std::vector<std::string>(), component), + cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault), Script(script), Code(code) { } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ec2b518..85df91d 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -24,8 +24,10 @@ cmInstallTargetGenerator ::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib, const char* file_permissions, std::vector<std::string> const& configurations, - const char* component, bool optional): - cmInstallGenerator(dest, configurations, component), Target(&t), + const char* component, + MessageLevel message, + bool optional): + cmInstallGenerator(dest, configurations, component, message), Target(&t), ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional) { this->ActionsPerConfig = true; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 0f21da7..7e5cc71 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -24,11 +24,11 @@ class cmInstallTargetGenerator: public cmInstallGenerator public: cmInstallTargetGenerator( cmTarget& t, const char* dest, bool implib, - const char* file_permissions = "", - std::vector<std::string> const& configurations - = std::vector<std::string>(), - const char* component = "Unspecified", - bool optional = false + const char* file_permissions, + std::vector<std::string> const& configurations, + const char* component, + MessageLevel message, + bool optional ); virtual ~cmInstallTargetGenerator(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8ae1157..5380d06 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1861,7 +1861,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, ((useWatcomQuote) ? WATCOMQUOTE : SHELL); bool escapeAllowMakeVars = !forResponseFile; cmOStringStream fout; - const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config); if(!pcli) { @@ -2998,6 +2998,17 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local, } //---------------------------------------------------------------------------- +class cmInstallTargetGeneratorLocal: public cmInstallTargetGenerator +{ +public: + cmInstallTargetGeneratorLocal(cmTarget& t, const char* dest, bool implib): + cmInstallTargetGenerator( + t, dest, implib, "", std::vector<std::string>(), "Unspecified", + cmInstallGenerator::SelectMessageLevel(t.GetMakefile()), + false) {} +}; + +//---------------------------------------------------------------------------- void cmLocalGenerator ::GenerateTargetInstallRules( @@ -3042,7 +3053,8 @@ cmLocalGenerator case cmTarget::MODULE_LIBRARY: { // Use a target install generator. - cmInstallTargetGenerator g(l->second, destination.c_str(), false); + cmInstallTargetGeneratorLocal + g(l->second, destination.c_str(), false); g.Generate(os, config, configurationTypes); } break; @@ -3052,16 +3064,19 @@ cmLocalGenerator // Special code to handle DLL. Install the import library // to the normal destination and the DLL to the runtime // destination. - cmInstallTargetGenerator g1(l->second, destination.c_str(), true); + cmInstallTargetGeneratorLocal + g1(l->second, destination.c_str(), true); g1.Generate(os, config, configurationTypes); // We also skip over the leading slash given by the user. destination = l->second.GetRuntimeInstallPath().substr(1); cmSystemTools::ConvertToUnixSlashes(destination); - cmInstallTargetGenerator g2(l->second, destination.c_str(), false); + cmInstallTargetGeneratorLocal + g2(l->second, destination.c_str(), false); g2.Generate(os, config, configurationTypes); #else // Use a target install generator. - cmInstallTargetGenerator g(l->second, destination.c_str(), false); + cmInstallTargetGeneratorLocal + g(l->second, destination.c_str(), false); g.Generate(os, config, configurationTypes); #endif } diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 3bf4f43..d26c2ea 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -40,7 +40,9 @@ public: VS9 = 90, VS10 = 100, VS11 = 110, - VS12 = 120 + VS12 = 120, + /* VS13 = 130 was skipped */ + VS14 = 140 }; cmLocalVisualStudioGenerator(VSVersion v); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 24689fb..816e6d8 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -542,22 +542,24 @@ cmNinjaTargetGenerator std::back_inserter(orderOnlyDeps), MapToNinjaPath()); } - cmNinjaDeps orderOnlyTarget; - orderOnlyTarget.push_back(this->OrderDependsTargetForTarget()); - this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(), - "Order-only phony target for " - + this->GetTargetName(), - orderOnlyTarget, - cmNinjaDeps(), - cmNinjaDeps(), - orderOnlyDeps); - + if (!orderOnlyDeps.empty()) + { + cmNinjaDeps orderOnlyTarget; + orderOnlyTarget.push_back(this->OrderDependsTargetForTarget()); + this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(), + "Order-only phony target for " + + this->GetTargetName(), + orderOnlyTarget, + cmNinjaDeps(), + cmNinjaDeps(), + orderOnlyDeps); + } std::vector<cmSourceFile const*> objectSources; this->GeneratorTarget->GetObjectSources(objectSources, config); for(std::vector<cmSourceFile const*>::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { - this->WriteObjectBuildStatement(*si); + this->WriteObjectBuildStatement(*si, !orderOnlyDeps.empty()); } std::string def = this->GeneratorTarget->GetModuleDefinitionFile(config); if(!def.empty()) @@ -570,7 +572,8 @@ cmNinjaTargetGenerator void cmNinjaTargetGenerator -::WriteObjectBuildStatement(cmSourceFile const* source) +::WriteObjectBuildStatement( + cmSourceFile const* source, bool writeOrderDependsTargetForTarget) { std::string comment; const std::string language = source->GetLanguage(); @@ -599,7 +602,10 @@ cmNinjaTargetGenerator } cmNinjaDeps orderOnlyDeps; - orderOnlyDeps.push_back(this->OrderDependsTargetForTarget()); + if (writeOrderDependsTargetForTarget) + { + orderOnlyDeps.push_back(this->OrderDependsTargetForTarget()); + } // If the source file is GENERATED and does not have a custom command // (either attached to this source file or another one), assume that one of diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 94c420f..40a15a3 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -114,7 +114,8 @@ protected: void WriteLanguageRules(const std::string& language); void WriteCompileRule(const std::string& language); void WriteObjectBuildStatements(); - void WriteObjectBuildStatement(cmSourceFile const* source); + void WriteObjectBuildStatement(cmSourceFile const* source, + bool writeOrderDependsTargetForTarget); void WriteCustomCommandBuildStatement(cmCustomCommand *cc); cmNinjaDeps GetObjects() const diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d0fa834..12a63b0 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -464,7 +464,7 @@ void cmSystemTools::ParseWindowsCommandLine(const char* command, { arg.append(backslashes, '\\'); backslashes = 0; - if(isspace(*c)) + if(((*c & 0x80) == 0 ) && isspace(*c)) { if(in_quotes) { @@ -2155,6 +2155,11 @@ void cmSystemTools::FindCMakeResources(const char* argv0) cmSystemToolsCMakeCommand = exe_dir; cmSystemToolsCMakeCommand += "/cmake"; cmSystemToolsCMakeCommand += cmSystemTools::GetExecutableExtension(); +#ifndef CMAKE_BUILD_WITH_CMAKE + // The bootstrap cmake does not provide the other tools, + // so use the directory where they are about to be built. + exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin"; +#endif cmSystemToolsCTestCommand = exe_dir; cmSystemToolsCTestCommand += "/ctest"; cmSystemToolsCTestCommand += cmSystemTools::GetExecutableExtension(); @@ -2207,7 +2212,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) } #else // Bootstrap build knows its source. - cmSystemToolsCMakeRoot = CMAKE_ROOT_DIR; + cmSystemToolsCMakeRoot = CMAKE_BOOTSTRAP_SOURCE_DIR; #endif } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 01edde9..aa0ed56 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -64,11 +64,16 @@ struct cmTarget::OutputInfo //---------------------------------------------------------------------------- struct cmTarget::ImportInfo { + ImportInfo(): NoSOName(false), Multiplicity(0) {} bool NoSOName; + int Multiplicity; std::string Location; std::string SOName; std::string ImportLibrary; - cmTarget::LinkInterface LinkInterface; + std::string Languages; + std::string Libraries; + std::string LibrariesProp; + std::string SharedDeps; }; //---------------------------------------------------------------------------- @@ -90,11 +95,13 @@ public: : Backtrace(NULL) { this->PolicyWarnedCMP0022 = false; + this->UtilityItemsDone = false; } cmTargetInternals(cmTargetInternals const&) : Backtrace(NULL) { this->PolicyWarnedCMP0022 = false; + this->UtilityItemsDone = false; } ~cmTargetInternals(); @@ -119,31 +126,45 @@ public: typedef std::map<TargetConfigPair, OptionalLinkInterface> LinkInterfaceMapType; LinkInterfaceMapType LinkInterfaceMap; + LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap; bool PolicyWarnedCMP0022; + typedef std::map<TargetConfigPair, cmTarget::LinkInterface> + ImportLinkInterfaceMapType; + ImportLinkInterfaceMapType ImportLinkInterfaceMap; + ImportLinkInterfaceMapType ImportLinkInterfaceUsageRequirementsOnlyMap; + typedef std::map<std::string, cmTarget::OutputInfo> OutputInfoMapType; OutputInfoMapType OutputInfoMap; - typedef std::map<TargetConfigPair, cmTarget::ImportInfo> - ImportInfoMapType; + typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType; ImportInfoMapType ImportInfoMap; typedef std::map<std::string, cmTarget::CompileInfo> CompileInfoMapType; CompileInfoMapType CompileInfoMap; // Cache link implementation computation from each configuration. + struct OptionalLinkImplementation: public cmTarget::LinkImplementation + { + OptionalLinkImplementation(): + LibrariesDone(false), LanguagesDone(false) {} + bool LibrariesDone; + bool LanguagesDone; + }; typedef std::map<TargetConfigPair, - cmTarget::LinkImplementation> LinkImplMapType; + OptionalLinkImplementation> LinkImplMapType; LinkImplMapType LinkImplMap; - typedef std::map<TargetConfigPair, cmTarget::LinkClosure> - LinkClosureMapType; + typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType; LinkClosureMapType LinkClosureMap; typedef std::map<TargetConfigPair, std::vector<cmSourceFile*> > SourceFilesMapType; SourceFilesMapType SourceFilesMap; + std::set<cmLinkItem> UtilityItems; + bool UtilityItemsDone; + struct TargetPropertyEntry { TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge, const std::string &targetName = std::string()) @@ -160,22 +181,25 @@ public: std::vector<TargetPropertyEntry*> SourceEntries; std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries; - mutable std::map<std::string, std::vector<TargetPropertyEntry*> > - CachedLinkInterfaceIncludeDirectoriesEntries; - mutable std::map<std::string, std::vector<TargetPropertyEntry*> > - CachedLinkInterfaceCompileOptionsEntries; - mutable std::map<std::string, std::vector<TargetPropertyEntry*> > - CachedLinkInterfaceCompileDefinitionsEntries; - mutable std::map<std::string, std::vector<TargetPropertyEntry*> > - CachedLinkInterfaceSourcesEntries; - mutable std::map<std::string, std::vector<TargetPropertyEntry*> > - CachedLinkInterfaceCompileFeaturesEntries; - - mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone; - mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone; - mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone; - mutable std::map<std::string, bool> CacheLinkInterfaceSourcesDone; - mutable std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone; + std::map<std::string, std::vector<TargetPropertyEntry*> > + CachedLinkInterfaceIncludeDirectoriesEntries; + std::map<std::string, std::vector<TargetPropertyEntry*> > + CachedLinkInterfaceCompileOptionsEntries; + std::map<std::string, std::vector<TargetPropertyEntry*> > + CachedLinkInterfaceCompileDefinitionsEntries; + std::map<std::string, std::vector<TargetPropertyEntry*> > + CachedLinkInterfaceSourcesEntries; + std::map<std::string, std::vector<TargetPropertyEntry*> > + CachedLinkInterfaceCompileFeaturesEntries; + std::map<std::string, std::vector<cmTarget const*> > + CachedLinkImplementationClosure; + + std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone; + std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone; + std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone; + std::map<std::string, bool> CacheLinkInterfaceSourcesDone; + std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone; + std::map<std::string, bool> CacheLinkImplementationClosureDone; }; //---------------------------------------------------------------------------- @@ -461,6 +485,22 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( } //---------------------------------------------------------------------------- +std::set<cmLinkItem> const& cmTarget::GetUtilityItems() const +{ + if(!this->Internal->UtilityItemsDone) + { + this->Internal->UtilityItemsDone = true; + for(std::set<std::string>::const_iterator i = this->Utilities.begin(); + i != this->Utilities.end(); ++i) + { + this->Internal->UtilityItems.insert( + cmLinkItem(*i, this->Makefile->FindTargetToUse(*i))); + } + } + return this->Internal->UtilityItems; +} + +//---------------------------------------------------------------------------- void cmTarget::FinishConfigure() { // Erase any cached link information that might have been comptued @@ -479,6 +519,9 @@ void cmTarget::ClearLinkMaps() this->LinkImplementationLanguageIsContextDependent = true; this->Internal->LinkImplMap.clear(); this->Internal->LinkInterfaceMap.clear(); + this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear(); + this->Internal->ImportLinkInterfaceMap.clear(); + this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap.clear(); this->Internal->LinkClosureMap.clear(); for (cmTargetLinkInformationMap::const_iterator it = this->LinkInformation.begin(); @@ -1195,63 +1238,6 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const } //---------------------------------------------------------------------------- -void cmTarget::GetDirectLinkLibraries(const std::string& config, - std::vector<std::string> &libs, - cmTarget const* head) const -{ - const char *prop = this->GetProperty("LINK_LIBRARIES"); - if (prop) - { - cmGeneratorExpression ge; - const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - - cmGeneratorExpressionDAGChecker dagChecker( - this->GetName(), - "LINK_LIBRARIES", 0, 0); - cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, - config, - false, - head, - &dagChecker), - libs); - - std::set<std::string> const& seenProps = cge->GetSeenTargetProperties(); - for (std::set<std::string>::const_iterator it = seenProps.begin(); - it != seenProps.end(); ++it) - { - if (!this->GetProperty(*it)) - { - this->LinkImplicitNullProperties.insert(*it); - } - } - cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards); - } -} - -//---------------------------------------------------------------------------- -void cmTarget::GetInterfaceLinkLibraries(const std::string& config, - std::vector<std::string> &libs, - cmTarget const* head) const -{ - const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES"); - if (prop) - { - cmGeneratorExpression ge; - const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - - cmGeneratorExpressionDAGChecker dagChecker( - this->GetName(), - "INTERFACE_LINK_LIBRARIES", 0, 0); - cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, - config, - false, - head, - &dagChecker), - libs); - } -} - -//---------------------------------------------------------------------------- std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, cmTarget::LinkLibraryType llt) const { @@ -2294,9 +2280,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const if(this->Makefile->IsOn("APPLE")) { - LinkImplementation const* impl = this->GetLinkImplementation(config, - this); - for(std::vector<std::string>::const_iterator + LinkImplementation const* impl = this->GetLinkImplementation(config); + for(std::vector<cmLinkItem>::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { @@ -3498,13 +3483,11 @@ public: Makefile(target->GetMakefile()), Target(target) { this->Visited.insert(target); } - void Visit(const std::string& name) + void Visit(cmLinkItem const& item) { - cmTarget *target = this->Makefile->FindTargetToUse(name); - - if(!target) + if(!item.Target) { - if(name.find("::") != std::string::npos) + if(item.find("::") != std::string::npos) { bool noMessage = false; cmake::MessageType messageType = cmake::FATAL_ERROR; @@ -3530,7 +3513,7 @@ public: if(!noMessage) { e << "Target \"" << this->Target->GetName() - << "\" links to target \"" << name + << "\" links to target \"" << item << "\" but the target was not found. Perhaps a find_package() " "call is missing for an IMPORTED target, or an ALIAS target is " "missing?"; @@ -3541,13 +3524,13 @@ public: } return; } - if(!this->Visited.insert(target).second) + if(!this->Visited.insert(item.Target).second) { return; } cmTarget::LinkInterface const* iface = - target->GetLinkInterface(this->Config, this->HeadTarget); + item.Target->GetLinkInterface(this->Config, this->HeadTarget); if(!iface) { return; } for(std::vector<std::string>::const_iterator @@ -3556,7 +3539,7 @@ public: this->Languages.insert(*li); } - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li) { this->Visit(*li); @@ -3572,25 +3555,22 @@ private: }; //---------------------------------------------------------------------------- -std::string cmTarget::GetLinkerLanguage(const std::string& config, - cmTarget const* head) const +std::string cmTarget::GetLinkerLanguage(const std::string& config) const { - cmTarget const* headTarget = head ? head : this; - return this->GetLinkClosure(config, headTarget)->LinkerLanguage; + return this->GetLinkClosure(config)->LinkerLanguage; } //---------------------------------------------------------------------------- -cmTarget::LinkClosure const* cmTarget::GetLinkClosure( - const std::string& config, - cmTarget const* head) const +cmTarget::LinkClosure const* +cmTarget::GetLinkClosure(const std::string& config) const { - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + std::string key(cmSystemTools::UpperCase(config)); cmTargetInternals::LinkClosureMapType::iterator i = this->Internal->LinkClosureMap.find(key); if(i == this->Internal->LinkClosureMap.end()) { LinkClosure lc; - this->ComputeLinkClosure(config, lc, head); + this->ComputeLinkClosure(config, lc); cmTargetInternals::LinkClosureMapType::value_type entry(key, lc); i = this->Internal->LinkClosureMap.insert(entry).first; } @@ -3651,12 +3631,12 @@ public: }; //---------------------------------------------------------------------------- -void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, - cmTarget const* head) const +void cmTarget::ComputeLinkClosure(const std::string& config, + LinkClosure& lc) const { // Get languages built in this target. std::set<std::string> languages; - LinkImplementation const* impl = this->GetLinkImplementation(config, head); + LinkImplementation const* impl = this->GetLinkImplementation(config); for(std::vector<std::string>::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) { @@ -3664,8 +3644,8 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, } // Add interface languages from linked targets. - cmTargetCollectLinkLanguages cll(this, config, languages, head); - for(std::vector<std::string>::const_iterator li = impl->Libraries.begin(); + cmTargetCollectLinkLanguages cll(this, config, languages, this); + for(std::vector<cmLinkItem>::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { cll.Visit(*li); @@ -3715,6 +3695,46 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, } //---------------------------------------------------------------------------- +void cmTarget::ExpandLinkItems(std::string const& prop, + std::string const& value, + std::string const& config, + cmTarget const* headTarget, + bool usage_requirements_only, + std::vector<cmLinkItem>& items) const +{ + cmGeneratorExpression ge; + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); + if(usage_requirements_only) + { + dagChecker.SetTransitivePropertiesOnly(); + } + std::vector<std::string> libs; + cmSystemTools::ExpandListArgument(ge.Parse(value)->Evaluate( + this->Makefile, + config, + false, + headTarget, + this, &dagChecker), libs); + this->LookupLinkItems(libs, items); +} + +//---------------------------------------------------------------------------- +void cmTarget::LookupLinkItems(std::vector<std::string> const& names, + std::vector<cmLinkItem>& items) const +{ + for(std::vector<std::string>::const_iterator i = names.begin(); + i != names.end(); ++i) + { + std::string name = this->CheckCMP0004(*i); + if(name == this->GetName() || name.empty()) + { + continue; + } + items.push_back(cmLinkItem(name, this->FindTargetToLink(name))); + } +} + +//---------------------------------------------------------------------------- const char* cmTarget::GetSuffixVariableInternal(bool implib) const { switch(this->GetType()) @@ -3845,8 +3865,7 @@ bool cmTarget::HasSOName(const std::string& config) const return ((this->GetType() == cmTarget::SHARED_LIBRARY || this->GetType() == cmTarget::MODULE_LIBRARY) && !this->GetPropertyAsBool("NO_SONAME") && - this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config, - this))); + this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config))); } //---------------------------------------------------------------------------- @@ -3855,7 +3874,7 @@ std::string cmTarget::GetSOName(const std::string& config) const if(this->IsImported()) { // Lookup the imported soname. - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { if(info->NoSOName) { @@ -3923,7 +3942,7 @@ bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const else { // Lookup the imported soname. - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { if(!info->NoSOName && !info->SOName.empty()) { @@ -4009,7 +4028,7 @@ bool cmTarget::IsImportedSharedLibWithoutSOName( { if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY) { - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { return info->NoSOName; } @@ -4133,7 +4152,7 @@ std::string cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const { std::string result; - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { result = implib? info->ImportLibrary : info->Location; } @@ -4219,7 +4238,7 @@ void cmTarget::GetFullNameInternal(const std::string& config, const char* suffixVar = this->GetSuffixVariableInternal(implib); // Check for language-specific default prefix and suffix. - std::string ll = this->GetLinkerLanguage(config, this); + std::string ll = this->GetLinkerLanguage(config); if(!ll.empty()) { if(!targetSuffix && suffixVar && *suffixVar) @@ -4507,9 +4526,12 @@ bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const { return false; } - std::vector<std::string> libs; - this->GetDirectLinkLibraries(config, libs, this); - return !libs.empty(); + if(LinkImplementation const* impl = + this->GetLinkImplementationLibraries(config)) + { + return !impl->Libraries.empty(); + } + return false; } //---------------------------------------------------------------------------- @@ -4558,7 +4580,7 @@ bool cmTarget::NeedRelinkBeforeInstall(const std::string& config) const } // Check for rpath support on this platform. - std::string ll = this->GetLinkerLanguage(config, this); + std::string ll = this->GetLinkerLanguage(config); if(!ll.empty()) { std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; @@ -5212,8 +5234,8 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, assert((impliedByUse ^ explicitlySet) || (!impliedByUse && !explicitlySet)); - std::vector<cmTarget*> deps; - tgt->GetTransitiveTargetClosure(config, tgt, deps); + std::vector<cmTarget const*> const& deps = + tgt->GetLinkImplementationClosure(config); if(deps.empty()) { @@ -5238,7 +5260,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, report += "\" property not set.\n"; } - for(std::vector<cmTarget*>::const_iterator li = + for(std::vector<cmTarget const*>::const_iterator li = deps.begin(); li != deps.end(); ++li) { @@ -5428,16 +5450,15 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, const std::string& interfaceProperty, const std::string& config) { - std::vector<cmTarget*> deps; - tgt->GetTransitiveTargetClosure(config, tgt, deps); + std::vector<cmTarget const*> const& deps = + tgt->GetLinkImplementationClosure(config); if(deps.empty()) { return false; } - for(std::vector<cmTarget*>::const_iterator li = - deps.begin(); + for(std::vector<cmTarget const*>::const_iterator li = deps.begin(); li != deps.end(); ++li) { const char *prop = (*li)->GetProperty(interfaceProperty); @@ -5647,7 +5668,7 @@ bool cmTarget::IsChrpathUsed(const std::string& config) const #if defined(CMAKE_USE_ELF_PARSER) // Enable if the rpath flag uses a separator and the target uses ELF // binaries. - std::string ll = this->GetLinkerLanguage(config, this); + std::string ll = this->GetLinkerLanguage(config); if(!ll.empty()) { std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; @@ -5672,8 +5693,7 @@ bool cmTarget::IsChrpathUsed(const std::string& config) const //---------------------------------------------------------------------------- cmTarget::ImportInfo const* -cmTarget::GetImportInfo(const std::string& config, - cmTarget const* headTarget) const +cmTarget::GetImportInfo(const std::string& config) const { // There is no imported information for non-imported targets. if(!this->IsImported()) @@ -5692,16 +5712,15 @@ cmTarget::GetImportInfo(const std::string& config, { config_upper = "NOCONFIG"; } - TargetConfigPair key(headTarget, config_upper); typedef cmTargetInternals::ImportInfoMapType ImportInfoMapType; ImportInfoMapType::const_iterator i = - this->Internal->ImportInfoMap.find(key); + this->Internal->ImportInfoMap.find(config_upper); if(i == this->Internal->ImportInfoMap.end()) { ImportInfo info; - this->ComputeImportInfo(config_upper, info, headTarget); - ImportInfoMapType::value_type entry(key, info); + this->ComputeImportInfo(config_upper, info); + ImportInfoMapType::value_type entry(config_upper, info); i = this->Internal->ImportInfoMap.insert(entry).first; } @@ -5853,8 +5872,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, //---------------------------------------------------------------------------- void cmTarget::ComputeImportInfo(std::string const& desired_config, - ImportInfo& info, - cmTarget const* headTarget) const + ImportInfo& info) const { // This method finds information about an imported target from its // properties. The "IMPORTED_" namespace is reserved for properties @@ -5893,19 +5911,8 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } if(propertyLibs) { - cmGeneratorExpression ge; - - cmGeneratorExpressionDAGChecker dagChecker( - this->GetName(), - linkProp, 0, 0); - cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs) - ->Evaluate(this->Makefile, - desired_config, - false, - headTarget, - this, - &dagChecker), - info.LinkInterface.Libraries); + info.LibrariesProp = linkProp; + info.Libraries = propertyLibs; } } if(this->GetType() == INTERFACE_LIBRARY) @@ -5991,13 +5998,12 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, linkProp += suffix; if(const char* config_libs = this->GetProperty(linkProp)) { - cmSystemTools::ExpandListArgument(config_libs, - info.LinkInterface.SharedDeps); + info.SharedDeps = config_libs; } else if(const char* libs = this->GetProperty("IMPORTED_LINK_DEPENDENT_LIBRARIES")) { - cmSystemTools::ExpandListArgument(libs, info.LinkInterface.SharedDeps); + info.SharedDeps = libs; } } @@ -6008,14 +6014,12 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, linkProp += suffix; if(const char* config_libs = this->GetProperty(linkProp)) { - cmSystemTools::ExpandListArgument(config_libs, - info.LinkInterface.Languages); + info.Languages = config_libs; } else if(const char* libs = this->GetProperty("IMPORTED_LINK_INTERFACE_LANGUAGES")) { - cmSystemTools::ExpandListArgument(libs, - info.LinkInterface.Languages); + info.Languages = libs; } } @@ -6026,12 +6030,12 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, linkProp += suffix; if(const char* config_reps = this->GetProperty(linkProp)) { - sscanf(config_reps, "%u", &info.LinkInterface.Multiplicity); + sscanf(config_reps, "%u", &info.Multiplicity); } else if(const char* reps = this->GetProperty("IMPORTED_LINK_INTERFACE_MULTIPLICITY")) { - sscanf(reps, "%u", &info.LinkInterface.Multiplicity); + sscanf(reps, "%u", &info.Multiplicity); } } } @@ -6044,11 +6048,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( // Imported targets have their own link interface. if(this->IsImported()) { - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, head)) - { - return &info->LinkInterface; - } - return 0; + return this->GetImportLinkInterface(config, head, false); } // Link interfaces are not supported for executables that do not @@ -6069,7 +6069,8 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( // Compute the link interface for this configuration. cmTargetInternals::OptionalLinkInterface iface; iface.ExplicitLibraries = - this->ComputeLinkInterfaceLibraries(config, iface, head, iface.Exists); + this->ComputeLinkInterfaceLibraries(config, iface, head, false, + iface.Exists); if (iface.Exists) { this->Internal->ComputeLinkInterface(this, config, iface, @@ -6092,16 +6093,13 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( //---------------------------------------------------------------------------- cmTarget::LinkInterface const* cmTarget::GetLinkInterfaceLibraries(const std::string& config, - cmTarget const* head) const + cmTarget const* head, + bool usage_requirements_only) const { // Imported targets have their own link interface. if(this->IsImported()) { - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, head)) - { - return &info->LinkInterface; - } - return 0; + return this->GetImportLinkInterface(config, head, usage_requirements_only); } // Link interfaces are not supported for executables that do not @@ -6114,126 +6112,141 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, // Lookup any existing link interface for this configuration. TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + cmTargetInternals::LinkInterfaceMapType& lim = + (usage_requirements_only ? + this->Internal->LinkInterfaceUsageRequirementsOnlyMap : + this->Internal->LinkInterfaceMap); - cmTargetInternals::LinkInterfaceMapType::iterator - i = this->Internal->LinkInterfaceMap.find(key); - if(i == this->Internal->LinkInterfaceMap.end()) + cmTargetInternals::LinkInterfaceMapType::iterator i = lim.find(key); + if(i == lim.end()) { // Compute the link interface for this configuration. cmTargetInternals::OptionalLinkInterface iface; - iface.ExplicitLibraries = this->ComputeLinkInterfaceLibraries(config, - iface, - head, - iface.Exists); + iface.ExplicitLibraries = + this->ComputeLinkInterfaceLibraries(config, iface, head, + usage_requirements_only, + iface.Exists); // Store the information for this configuration. cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface); - i = this->Internal->LinkInterfaceMap.insert(entry).first; + i = lim.insert(entry).first; } return i->second.Exists ? &i->second : 0; } //---------------------------------------------------------------------------- +cmTarget::LinkInterface const* +cmTarget::GetImportLinkInterface(const std::string& config, + cmTarget const* headTarget, + bool usage_requirements_only) const +{ + cmTarget::ImportInfo const* info = this->GetImportInfo(config); + if(!info) + { + return 0; + } + + TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); + cmTargetInternals::ImportLinkInterfaceMapType& lim = + (usage_requirements_only ? + this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap : + this->Internal->ImportLinkInterfaceMap); + + cmTargetInternals::ImportLinkInterfaceMapType::iterator i = lim.find(key); + if(i == lim.end()) + { + LinkInterface iface; + iface.Multiplicity = info->Multiplicity; + cmSystemTools::ExpandListArgument(info->Languages, iface.Languages); + this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config, + headTarget, usage_requirements_only, + iface.Libraries); + { + std::vector<std::string> deps; + cmSystemTools::ExpandListArgument(info->SharedDeps, deps); + this->LookupLinkItems(deps, iface.SharedDeps); + } + + cmTargetInternals::ImportLinkInterfaceMapType::value_type + entry(key, iface); + i = lim.insert(entry).first; + } + return &i->second; +} + +//---------------------------------------------------------------------------- void processILibs(const std::string& config, cmTarget const* headTarget, - std::string const& name, - std::vector<cmTarget*>& tgts, std::set<cmTarget*>& emitted) + cmLinkItem const& item, + std::vector<cmTarget const*>& tgts, + std::set<cmTarget const*>& emitted) { - if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(name)) + if (item.Target && emitted.insert(item.Target).second) { - if (emitted.insert(tgt).second) + tgts.push_back(item.Target); + if(cmTarget::LinkInterface const* iface = + item.Target->GetLinkInterfaceLibraries(config, headTarget, false)) { - tgts.push_back(tgt); - cmTarget::LinkInterface const* iface = - tgt->GetLinkInterfaceLibraries(config, headTarget); - if (iface) - { - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin(); - it != iface->Libraries.end(); ++it) - { - processILibs(config, headTarget, *it, tgts, emitted); - } + it != iface->Libraries.end(); ++it) + { + processILibs(config, headTarget, *it, tgts, emitted); } } } } //---------------------------------------------------------------------------- -void cmTarget::GetTransitiveTargetClosure(const std::string& config, - cmTarget const* headTarget, - std::vector<cmTarget*> &tgts) const +std::vector<cmTarget const*> const& +cmTarget::GetLinkImplementationClosure(const std::string& config) const { - std::set<cmTarget*> emitted; + std::vector<cmTarget const*>& tgts = + this->Internal->CachedLinkImplementationClosure[config]; + if(!this->Internal->CacheLinkImplementationClosureDone[config]) + { + this->Internal->CacheLinkImplementationClosureDone[config] = true; + std::set<cmTarget const*> emitted; - cmTarget::LinkImplementation const* impl - = this->GetLinkImplementationLibraries(config, headTarget); + cmTarget::LinkImplementation const* impl + = this->GetLinkImplementationLibraries(config); - for(std::vector<std::string>::const_iterator it = impl->Libraries.begin(); - it != impl->Libraries.end(); ++it) - { - processILibs(config, headTarget, *it, tgts, emitted); + for(std::vector<cmLinkItem>::const_iterator it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) + { + processILibs(config, this, *it, tgts , emitted); + } } + return tgts; } //---------------------------------------------------------------------------- void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, - std::vector<cmTarget*> &tgts) const -{ - cmTarget::LinkInterface const* iface - = this->GetLinkInterfaceLibraries(config, headTarget); - if (!iface) - { - return; - } - if(this->GetType() != STATIC_LIBRARY - || this->GetPolicyStatusCMP0022() == cmPolicies::WARN - || this->GetPolicyStatusCMP0022() == cmPolicies::OLD) - { - for(std::vector<std::string>::const_iterator it = iface->Libraries.begin(); + std::vector<cmTarget const*> &tgts) const +{ + // The $<LINK_ONLY> expression may be in a link interface to specify private + // link dependencies that are otherwise excluded from usage requirements. + // Currently $<LINK_ONLY> is internal to CMake and only ever added by + // target_link_libraries for PRIVATE dependencies of STATIC libraries in + // INTERFACE_LINK_LIBRARIES which is used under CMP0022 NEW behavior. + bool usage_requirements_only = + this->GetType() == STATIC_LIBRARY && + this->GetPolicyStatusCMP0022() != cmPolicies::WARN && + this->GetPolicyStatusCMP0022() != cmPolicies::OLD; + if(cmTarget::LinkInterface const* iface = + this->GetLinkInterfaceLibraries(config, headTarget, + usage_requirements_only)) + { + for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) { - if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(*it)) + if (it->Target) { - tgts.push_back(tgt); + tgts.push_back(it->Target); } } - return; - } - - const char* linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; - const char* interfaceLibs = this->GetProperty(linkIfaceProp); - - if (!interfaceLibs) - { - return; - } - - // The interface libraries have been explicitly set. - cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - linkIfaceProp, 0, 0); - dagChecker.SetTransitivePropertiesOnly(); - std::vector<std::string> libs; - cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate( - this->Makefile, - config, - false, - headTarget, - this, &dagChecker), libs); - - for(std::vector<std::string>::const_iterator it = libs.begin(); - it != libs.end(); ++it) - { - if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(*it)) - { - tgts.push_back(tgt); - } } } @@ -6241,6 +6254,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, LinkInterface& iface, cmTarget const* headTarget, + bool usage_requirements_only, bool &exists) const { // Construct the property name suffix for this configuration. @@ -6325,15 +6339,9 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, if(explicitLibraries) { // The interface libraries have been explicitly set. - cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - linkIfaceProp, 0, 0); - cmSystemTools::ExpandListArgument(ge.Parse(explicitLibraries)->Evaluate( - this->Makefile, - config, - false, - headTarget, - this, &dagChecker), iface.Libraries); + this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config, + headTarget, usage_requirements_only, + iface.Libraries); } else if (this->PolicyStatusCMP0022 == cmPolicies::WARN || this->PolicyStatusCMP0022 == cmPolicies::OLD) @@ -6344,32 +6352,27 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, { // The link implementation is the default link interface. LinkImplementation const* impl = - this->GetLinkImplementationLibraries(config, headTarget); + this->GetLinkImplementationLibrariesInternal(config, headTarget); iface.Libraries = impl->Libraries; if(this->PolicyStatusCMP0022 == cmPolicies::WARN && - !this->Internal->PolicyWarnedCMP0022) + !this->Internal->PolicyWarnedCMP0022 && !usage_requirements_only) { // Compare the link implementation fallback link interface to the // preferred new link interface property and warn if different. - cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "INTERFACE_LINK_LIBRARIES", 0, 0); - std::vector<std::string> ifaceLibs; - const char* newExplicitLibraries = - this->GetProperty("INTERFACE_LINK_LIBRARIES"); - cmSystemTools::ExpandListArgument( - ge.Parse(newExplicitLibraries)->Evaluate(this->Makefile, - config, - false, - headTarget, - this, &dagChecker), - ifaceLibs); + std::vector<cmLinkItem> ifaceLibs; + std::string newProp = "INTERFACE_LINK_LIBRARIES"; + if(const char* newExplicitLibraries = this->GetProperty(newProp)) + { + this->ExpandLinkItems(newProp, newExplicitLibraries, config, + headTarget, usage_requirements_only, + ifaceLibs); + } if (ifaceLibs != impl->Libraries) { std::string oldLibraries; std::string newLibraries; const char *sep = ""; - for(std::vector<std::string>::const_iterator it + for(std::vector<cmLinkItem>::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { oldLibraries += sep; @@ -6377,7 +6380,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, sep = ";"; } sep = ""; - for(std::vector<std::string>::const_iterator it + for(std::vector<cmLinkItem>::const_iterator it = ifaceLibs.begin(); it != ifaceLibs.end(); ++it) { newLibraries += sep; @@ -6428,7 +6431,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. std::set<std::string> emitted; - for(std::vector<std::string>::const_iterator + for(std::vector<cmLinkItem>::const_iterator li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li) { emitted.insert(*li); @@ -6436,16 +6439,16 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, if (thisTarget->GetType() != cmTarget::INTERFACE_LIBRARY) { cmTarget::LinkImplementation const* impl = - thisTarget->GetLinkImplementation(config, headTarget); - for(std::vector<std::string>::const_iterator + thisTarget->GetLinkImplementation(config); + for(std::vector<cmLinkItem>::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { if(emitted.insert(*li).second) { - if(cmTarget* tgt = thisTarget->Makefile->FindTargetToUse(*li)) + if(li->Target) { // This is a runtime dependency on another shared library. - if(tgt->GetType() == cmTarget::SHARED_LIBRARY) + if(li->Target->GetType() == cmTarget::SHARED_LIBRARY) { iface.SharedDeps.push_back(*li); } @@ -6467,7 +6470,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // The link implementation is the default link interface. cmTarget::LinkImplementation const* - impl = thisTarget->GetLinkImplementation(config, headTarget); + impl = thisTarget->GetLinkImplementationLibrariesInternal(config, + headTarget); iface.ImplementationIsInterface = true; iface.WrongConfigLibraries = impl->WrongConfigLibraries; } @@ -6476,7 +6480,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Targets using this archive need its language runtime libraries. if(cmTarget::LinkImplementation const* impl = - thisTarget->GetLinkImplementation(config, headTarget)) + thisTarget->GetLinkImplementation(config)) { iface.Languages = impl->Languages; } @@ -6514,8 +6518,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementation(const std::string& config, - cmTarget const* head) const +cmTarget::GetLinkImplementation(const std::string& config) const { // There is no link implementation for imported targets. if(this->IsImported()) @@ -6523,34 +6526,34 @@ cmTarget::GetLinkImplementation(const std::string& config, return 0; } - // Lookup any existing link implementation for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); - - cmTargetInternals::LinkImplMapType::iterator - i = this->Internal->LinkImplMap.find(key); - if(i == this->Internal->LinkImplMap.end()) + // Populate the link implementation for this configuration. + TargetConfigPair key(this, cmSystemTools::UpperCase(config)); + cmTargetInternals::OptionalLinkImplementation& + impl = this->Internal->LinkImplMap[key]; + if(!impl.LibrariesDone) { - // Compute the link implementation for this configuration. - LinkImplementation impl; - this->ComputeLinkImplementation(config, impl, head); - this->ComputeLinkImplementationLanguages(config, impl, head); - - // Store the information for this configuration. - cmTargetInternals::LinkImplMapType::value_type entry(key, impl); - i = this->Internal->LinkImplMap.insert(entry).first; + impl.LibrariesDone = true; + this->ComputeLinkImplementation(config, impl, this); } - else if (i->second.Languages.empty()) + if(!impl.LanguagesDone) { - this->ComputeLinkImplementationLanguages(config, i->second, head); + impl.LanguagesDone = true; + this->ComputeLinkImplementationLanguages(config, impl, this); } + return &impl; +} - return &i->second; +//---------------------------------------------------------------------------- +cmTarget::LinkImplementation const* +cmTarget::GetLinkImplementationLibraries(const std::string& config) const +{ + return this->GetLinkImplementationLibrariesInternal(config, this); } //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementationLibraries(const std::string& config, - cmTarget const* head) const +cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, + cmTarget const* head) const { // There is no link implementation for imported targets. if(this->IsImported()) @@ -6558,23 +6561,16 @@ cmTarget::GetLinkImplementationLibraries(const std::string& config, return 0; } - // Lookup any existing link implementation for this configuration. + // Populate the link implementation libraries for this configuration. TargetConfigPair key(head, cmSystemTools::UpperCase(config)); - - cmTargetInternals::LinkImplMapType::iterator - i = this->Internal->LinkImplMap.find(key); - if(i == this->Internal->LinkImplMap.end()) + cmTargetInternals::OptionalLinkImplementation& + impl = this->Internal->LinkImplMap[key]; + if(!impl.LibrariesDone) { - // Compute the link implementation for this configuration. - LinkImplementation impl; - this->ComputeLinkImplementation(config, impl, head); - - // Store the information for this configuration. - cmTargetInternals::LinkImplMapType::value_type entry(key, impl); - i = this->Internal->LinkImplMap.insert(entry).first; + impl.LibrariesDone = true; + this->ComputeLinkImplementation(config, impl, this); } - - return &i->second; + return &impl; } //---------------------------------------------------------------------------- @@ -6583,55 +6579,84 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, cmTarget const* head) const { // Collect libraries directly linked in this configuration. - std::vector<std::string> llibs; - this->GetDirectLinkLibraries(config, llibs, head); - for(std::vector<std::string>::const_iterator li = llibs.begin(); - li != llibs.end(); ++li) + for (std::vector<cmValueWithOrigin>::const_iterator + le = this->Internal->LinkImplementationPropertyEntries.begin(), + end = this->Internal->LinkImplementationPropertyEntries.end(); + le != end; ++le) { - // Skip entries that resolve to the target itself or are empty. - std::string item = this->CheckCMP0004(*li); - if(item == this->GetName() || item.empty()) + std::vector<std::string> llibs; + cmGeneratorExpressionDAGChecker dagChecker( + this->GetName(), + "LINK_LIBRARIES", 0, 0); + cmGeneratorExpression ge(&le->Backtrace); + cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge = + ge.Parse(le->Value); + cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, + config, + false, + head, + &dagChecker), + llibs); + + for(std::vector<std::string>::const_iterator li = llibs.begin(); + li != llibs.end(); ++li) { - if(item == this->GetName()) + // Skip entries that resolve to the target itself or are empty. + std::string name = this->CheckCMP0004(*li); + if(name == this->GetName() || name.empty()) { - bool noMessage = false; - cmake::MessageType messageType = cmake::FATAL_ERROR; - cmOStringStream e; - switch(this->GetPolicyStatusCMP0038()) + if(name == this->GetName()) { - case cmPolicies::WARN: + bool noMessage = false; + cmake::MessageType messageType = cmake::FATAL_ERROR; + cmOStringStream e; + switch(this->GetPolicyStatusCMP0038()) { - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n"; - messageType = cmake::AUTHOR_WARNING; + case cmPolicies::WARN: + { + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n"; + messageType = cmake::AUTHOR_WARNING; + } + break; + case cmPolicies::OLD: + noMessage = true; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + // Issue the fatal message. + break; } - break; - case cmPolicies::OLD: - noMessage = true; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::NEW: - // Issue the fatal message. - break; - } - if(!noMessage) - { - e << "Target \"" << this->GetName() << "\" links to itself."; - this->Makefile->GetCMakeInstance()->IssueMessage(messageType, - e.str(), - this->GetBacktrace()); - if (messageType == cmake::FATAL_ERROR) + if(!noMessage) { - return; + e << "Target \"" << this->GetName() << "\" links to itself."; + this->Makefile->GetCMakeInstance()->IssueMessage( + messageType, e.str(), this->GetBacktrace()); + if (messageType == cmake::FATAL_ERROR) + { + return; + } } } + continue; } - continue; + + // The entry is meant for this configuration. + impl.Libraries.push_back( + cmLinkItem(name, this->FindTargetToLink(name))); } - // The entry is meant for this configuration. - impl.Libraries.push_back(item); + std::set<std::string> const& seenProps = cge->GetSeenTargetProperties(); + for (std::set<std::string>::const_iterator it = seenProps.begin(); + it != seenProps.end(); ++it) + { + if (!this->GetProperty(*it)) + { + this->LinkImplicitNullProperties.insert(*it); + } + } + cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards); } cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config); @@ -6641,13 +6666,14 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, { if(li->second != cmTarget::GENERAL && li->second != linkType) { - std::string item = this->CheckCMP0004(li->first); - if(item == this->GetName() || item.empty()) + std::string name = this->CheckCMP0004(li->first); + if(name == this->GetName() || name.empty()) { continue; } // Support OLD behavior for CMP0003. - impl.WrongConfigLibraries.push_back(item); + impl.WrongConfigLibraries.push_back( + cmLinkItem(name, this->FindTargetToLink(name))); } } } @@ -6671,6 +6697,37 @@ cmTarget::ComputeLinkImplementationLanguages(const std::string& config, } //---------------------------------------------------------------------------- +cmTarget const* cmTarget::FindTargetToLink(std::string const& name) const +{ + cmTarget const* tgt = this->Makefile->FindTargetToUse(name); + + // Skip targets that will not really be linked. This is probably a + // name conflict between an external library and an executable + // within the project. + if(tgt && tgt->GetType() == cmTarget::EXECUTABLE && + !tgt->IsExecutableWithExports()) + { + tgt = 0; + } + + if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "Target \"" << this->GetName() << "\" links to " + "OBJECT library \"" << tgt->GetName() << "\" but this is not " + "allowed. " + "One may link only to STATIC or SHARED libraries, or to executables " + "with the ENABLE_EXPORTS property set."; + cmake* cm = this->Makefile->GetCMakeInstance(); + cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); + tgt = 0; + } + + // Return the target found, if any. + return tgt; +} + +//---------------------------------------------------------------------------- std::string cmTarget::CheckCMP0004(std::string const& item) const { // Strip whitespace off the library names because we used to do this @@ -6967,19 +7024,17 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, //---------------------------------------------------------------------------- cmComputeLinkInformation* -cmTarget::GetLinkInformation(const std::string& config, - cmTarget const* head) const +cmTarget::GetLinkInformation(const std::string& config) const { - cmTarget const* headTarget = head ? head : this; // Lookup any existing information for this configuration. - TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); + std::string key(cmSystemTools::UpperCase(config)); cmTargetLinkInformationMap::iterator i = this->LinkInformation.find(key); if(i == this->LinkInformation.end()) { // Compute information for this configuration. cmComputeLinkInformation* info = - new cmComputeLinkInformation(this, config, headTarget); + new cmComputeLinkInformation(this, config); if(!info || !info->Compute()) { delete info; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 2d51835..9d1f966 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -43,12 +43,22 @@ class cmTarget; class cmGeneratorTarget; class cmTargetTraceDependencies; +// Basic information about each link item. +class cmLinkItem: public std::string +{ + typedef std::string std_string; +public: + cmLinkItem(): std_string(), Target(0) {} + cmLinkItem(const std_string& n, + cmTarget const* t): std_string(n), Target(t) {} + cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {} + cmTarget const* Target; +}; + struct cmTargetLinkInformationMap: - public std::map<std::pair<cmTarget const* , std::string>, - cmComputeLinkInformation*> + public std::map<std::string, cmComputeLinkInformation*> { - typedef std::map<std::pair<cmTarget const* , std::string>, - cmComputeLinkInformation*> derived; + typedef std::map<std::string, cmComputeLinkInformation*> derived; cmTargetLinkInformationMap() {} cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r); ~cmTargetLinkInformationMap(); @@ -159,12 +169,6 @@ public: return this->LinkLibraries;} const LinkLibraryVectorType &GetOriginalLinkLibraries() const {return this->OriginalLinkLibraries;} - void GetDirectLinkLibraries(const std::string& config, - std::vector<std::string> &, - cmTarget const* head) const; - void GetInterfaceLinkLibraries(const std::string& config, - std::vector<std::string> &, - cmTarget const* head) const; /** Compute the link type to use for the given configuration. */ LinkLibraryType ComputeLinkType(const std::string& config) const; @@ -221,6 +225,7 @@ public: void AddUtility(const std::string& u, cmMakefile *makefile = 0); ///! Get the utilities used by this target std::set<std::string>const& GetUtilities() const { return this->Utilities; } + std::set<cmLinkItem>const& GetUtilityItems() const; cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; /** Finalize the target at the end of the Configure step. */ @@ -252,10 +257,10 @@ public: std::vector<std::string> Languages; // Libraries listed in the interface. - std::vector<std::string> Libraries; + std::vector<cmLinkItem> Libraries; // Shared library dependencies needed for linking on some platforms. - std::vector<std::string> SharedDeps; + std::vector<cmLinkItem> SharedDeps; // Number of repetitions of a strongly connected component of two // or more static libraries. @@ -263,7 +268,7 @@ public: // Libraries listed for other configurations. // Needed only for OLD behavior of CMP0003. - std::vector<std::string> WrongConfigLibraries; + std::vector<cmLinkItem> WrongConfigLibraries; bool ImplementationIsInterface; @@ -275,13 +280,13 @@ public: LinkInterface const* GetLinkInterface(const std::string& config, cmTarget const* headTarget) const; LinkInterface const* GetLinkInterfaceLibraries(const std::string& config, - cmTarget const* headTarget) const; - void GetTransitivePropertyTargets(const std::string& config, - cmTarget const* headTarget, - std::vector<cmTarget*> &libs) const; - void GetTransitiveTargetClosure(const std::string& config, cmTarget const* headTarget, - std::vector<cmTarget*> &libs) const; + bool usage_requirements_only) const; + void GetTransitivePropertyTargets(const std::string& config, + cmTarget const* headTarget, + std::vector<cmTarget const*> &libs) const; + std::vector<cmTarget const*> const& + GetLinkImplementationClosure(const std::string& config) const; /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ @@ -291,18 +296,17 @@ public: std::vector<std::string> Languages; // Libraries linked directly in this configuration. - std::vector<std::string> Libraries; + std::vector<cmLinkItem> Libraries; // Libraries linked directly in other configurations. // Needed only for OLD behavior of CMP0003. - std::vector<std::string> WrongConfigLibraries; + std::vector<cmLinkItem> WrongConfigLibraries; }; - LinkImplementation const* GetLinkImplementation(const std::string& config, - cmTarget const* head) const; + LinkImplementation const* + GetLinkImplementation(const std::string& config) const; - LinkImplementation const* GetLinkImplementationLibraries( - const std::string& config, - cmTarget const* head) const; + LinkImplementation const* + GetLinkImplementationLibraries(const std::string& config) const; /** Link information from the transitive closure of the link implementation and the interfaces of its dependencies. */ @@ -314,8 +318,9 @@ public: // Languages whose runtime libraries must be linked. std::vector<std::string> Languages; }; - LinkClosure const* GetLinkClosure(const std::string& config, - cmTarget const* head) const; + LinkClosure const* GetLinkClosure(const std::string& config) const; + + cmTarget const* FindTargetToLink(std::string const& name) const; /** Strip off leading and trailing whitespace from an item named in the link dependencies of this target. */ @@ -361,8 +366,7 @@ public: GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; ///! Return the preferred linker language for this target - std::string GetLinkerLanguage(const std::string& config = "", - cmTarget const* head = 0) const; + std::string GetLinkerLanguage(const std::string& config = "") const; /** Get the full name of the target according to the settings in its makefile. */ @@ -446,8 +450,8 @@ public: * install tree. For example: "\@rpath/" or "\@loader_path/". */ std::string GetInstallNameDirForInstallTree() const; - cmComputeLinkInformation* GetLinkInformation(const std::string& config, - cmTarget const* head = 0) const; + cmComputeLinkInformation* + GetLinkInformation(const std::string& config) const; // Get the properties cmPropertyMap &GetProperties() const { return this->Properties; } @@ -740,10 +744,9 @@ private: // Cache import information from properties for each configuration. struct ImportInfo; - ImportInfo const* GetImportInfo(const std::string& config, - cmTarget const* workingTarget) const; - void ComputeImportInfo(std::string const& desired_config, ImportInfo& info, - cmTarget const* head) const; + ImportInfo const* GetImportInfo(const std::string& config) const; + void ComputeImportInfo(std::string const& desired_config, + ImportInfo& info) const; // Cache target compile paths for each configuration. struct CompileInfo; @@ -753,19 +756,33 @@ private: void CheckPropertyCompatibility(cmComputeLinkInformation *info, const std::string& config) const; + LinkInterface const* + GetImportLinkInterface(const std::string& config, cmTarget const* head, + bool usage_requirements_only) const; + const char* ComputeLinkInterfaceLibraries(const std::string& config, LinkInterface& iface, cmTarget const* head, + bool usage_requirements_only, bool &exists) const; + LinkImplementation const* + GetLinkImplementationLibrariesInternal(const std::string& config, + cmTarget const* head) const; void ComputeLinkImplementation(const std::string& config, LinkImplementation& impl, cmTarget const* head) const; void ComputeLinkImplementationLanguages(const std::string& config, LinkImplementation& impl, cmTarget const* head) const; - void ComputeLinkClosure(const std::string& config, LinkClosure& lc, - cmTarget const* head) const; + void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const; + + void ExpandLinkItems(std::string const& prop, std::string const& value, + std::string const& config, cmTarget const* headTarget, + bool usage_requirements_only, + std::vector<cmLinkItem>& items) const; + void LookupLinkItems(std::vector<std::string> const& names, + std::vector<cmLinkItem>& items) const; std::string ProcessSourceItemCMP0049(const std::string& s); diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h new file mode 100644 index 0000000..422f47b --- /dev/null +++ b/Source/cmVS14CLFlagTable.h @@ -0,0 +1,296 @@ +static cmVS7FlagTable cmVS14CLFlagTable[] = +{ + + //Enum Properties + {"DebugInformationFormat", "", + "None", "None", 0}, + {"DebugInformationFormat", "Z7", + "C7 compatible", "OldStyle", 0}, + {"DebugInformationFormat", "Zi", + "Program Database", "ProgramDatabase", 0}, + {"DebugInformationFormat", "ZI", + "Program Database for Edit And Continue", "EditAndContinue", 0}, + + {"WarningLevel", "W0", + "Turn Off All Warnings", "TurnOffAllWarnings", 0}, + {"WarningLevel", "W1", + "Level1", "Level1", 0}, + {"WarningLevel", "W2", + "Level2", "Level2", 0}, + {"WarningLevel", "W3", + "Level3", "Level3", 0}, + {"WarningLevel", "W4", + "Level4", "Level4", 0}, + {"WarningLevel", "Wall", + "EnableAllWarnings", "EnableAllWarnings", 0}, + + {"Optimization", "", + "Custom", "Custom", 0}, + {"Optimization", "Od", + "Disabled", "Disabled", 0}, + {"Optimization", "O1", + "Minimize Size", "MinSpace", 0}, + {"Optimization", "O2", + "Maximize Speed", "MaxSpeed", 0}, + {"Optimization", "Ox", + "Full Optimization", "Full", 0}, + + {"InlineFunctionExpansion", "", + "Default", "Default", 0}, + {"InlineFunctionExpansion", "Ob0", + "Disabled", "Disabled", 0}, + {"InlineFunctionExpansion", "Ob1", + "Only __inline", "OnlyExplicitInline", 0}, + {"InlineFunctionExpansion", "Ob2", + "Any Suitable", "AnySuitable", 0}, + + {"FavorSizeOrSpeed", "Os", + "Favor small code", "Size", 0}, + {"FavorSizeOrSpeed", "Ot", + "Favor fast code", "Speed", 0}, + {"FavorSizeOrSpeed", "", + "Neither", "Neither", 0}, + + {"ExceptionHandling", "EHa", + "Yes with SEH Exceptions", "Async", 0}, + {"ExceptionHandling", "EHsc", + "Yes", "Sync", 0}, + {"ExceptionHandling", "EHs", + "Yes with Extern C functions", "SyncCThrow", 0}, + {"ExceptionHandling", "", + "No", "false", 0}, + + {"BasicRuntimeChecks", "RTCs", + "Stack Frames", "StackFrameRuntimeCheck", 0}, + {"BasicRuntimeChecks", "RTCu", + "Uninitialized variables", "UninitializedLocalUsageCheck", 0}, + {"BasicRuntimeChecks", "RTC1", + "Both (/RTC1, equiv. to /RTCsu)", "EnableFastChecks", 0}, + {"BasicRuntimeChecks", "", + "Default", "Default", 0}, + + {"RuntimeLibrary", "MT", + "Multi-threaded", "MultiThreaded", 0}, + {"RuntimeLibrary", "MTd", + "Multi-threaded Debug", "MultiThreadedDebug", 0}, + {"RuntimeLibrary", "MD", + "Multi-threaded DLL", "MultiThreadedDLL", 0}, + {"RuntimeLibrary", "MDd", + "Multi-threaded Debug DLL", "MultiThreadedDebugDLL", 0}, + + {"StructMemberAlignment", "Zp1", + "1 Byte", "1Byte", 0}, + {"StructMemberAlignment", "Zp2", + "2 Bytes", "2Bytes", 0}, + {"StructMemberAlignment", "Zp4", + "4 Byte", "4Bytes", 0}, + {"StructMemberAlignment", "Zp8", + "8 Bytes", "8Bytes", 0}, + {"StructMemberAlignment", "Zp16", + "16 Bytes", "16Bytes", 0}, + {"StructMemberAlignment", "", + "Default", "Default", 0}, + + {"BufferSecurityCheck", "GS-", + "Disable Security Check", "false", 0}, + {"BufferSecurityCheck", "GS", + "Enable Security Check", "true", 0}, + + {"EnableEnhancedInstructionSet", "arch:SSE", + "Streaming SIMD Extensions", "StreamingSIMDExtensions", 0}, + {"EnableEnhancedInstructionSet", "arch:SSE2", + "Streaming SIMD Extensions 2", "StreamingSIMDExtensions2", 0}, + {"EnableEnhancedInstructionSet", "arch:AVX", + "Advanced Vector Extensions", "AdvancedVectorExtensions", 0}, + {"EnableEnhancedInstructionSet", "arch:AVX2", + "Advanced Vector Extensions 2", "AdvancedVectorExtensions2", 0}, + {"EnableEnhancedInstructionSet", "arch:IA32", + "No Enhanced Instructions", "NoExtensions", 0}, + {"EnableEnhancedInstructionSet", "", + "Not Set", "NotSet", 0}, + + {"FloatingPointModel", "fp:precise", + "Precise", "Precise", 0}, + {"FloatingPointModel", "fp:strict", + "Strict", "Strict", 0}, + {"FloatingPointModel", "fp:fast", + "Fast", "Fast", 0}, + + {"PrecompiledHeader", "Yc", + "Create", "Create", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeader", "Yu", + "Use", "Use", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeader", "", + "Not Using Precompiled Headers", "NotUsing", 0}, + + {"AssemblerOutput", "", + "No Listing", "NoListing", 0}, + {"AssemblerOutput", "FA", + "Assembly-Only Listing", "AssemblyCode", 0}, + {"AssemblerOutput", "FAc", + "Assembly With Machine Code", "AssemblyAndMachineCode", 0}, + {"AssemblerOutput", "FAs", + "Assembly With Source Code", "AssemblyAndSourceCode", 0}, + {"AssemblerOutput", "FAcs", + "Assembly, Machine Code and Source", "All", 0}, + + {"CallingConvention", "Gd", + "__cdecl", "Cdecl", 0}, + {"CallingConvention", "Gr", + "__fastcall", "FastCall", 0}, + {"CallingConvention", "Gz", + "__stdcall", "StdCall", 0}, + {"CallingConvention", "Gv", + "__vectorcall", "VectorCall", 0}, + + {"CompileAs", "", + "Default", "Default", 0}, + {"CompileAs", "TC", + "Compile as C Code", "CompileAsC", 0}, + {"CompileAs", "TP", + "Compile as C++ Code", "CompileAsCpp", 0}, + + {"ErrorReporting", "errorReport:none", + "Do Not Send Report", "None", 0}, + {"ErrorReporting", "errorReport:prompt", + "Prompt Immediately", "Prompt", 0}, + {"ErrorReporting", "errorReport:queue", + "Queue For Next Login", "Queue", 0}, + {"ErrorReporting", "errorReport:send", + "Send Automatically", "Send", 0}, + + {"CompileAsManaged", "", + "No Common Language RunTime Support", "false", 0}, + {"CompileAsManaged", "clr", + "Common Language RunTime Support", "true", 0}, + {"CompileAsManaged", "clr:pure", + "Pure MSIL Common Language RunTime Support", "Pure", 0}, + {"CompileAsManaged", "clr:safe", + "Safe MSIL Common Language RunTime Support", "Safe", 0}, + {"CompileAsManaged", "clr:oldSyntax", + "Common Language RunTime Support, Old Syntax", "OldSyntax", 0}, + + + //Bool Properties + {"CompileAsWinRT", "ZW", "", "true", 0}, + {"WinRTNoStdLib", "ZW:nostdlib", "", "true", 0}, + {"SuppressStartupBanner", "nologo", "", "true", 0}, + {"TreatWarningAsError", "WX-", "", "false", 0}, + {"TreatWarningAsError", "WX", "", "true", 0}, + {"SDLCheck", "sdl-", "", "false", 0}, + {"SDLCheck", "sdl", "", "true", 0}, + {"IntrinsicFunctions", "Oi", "", "true", 0}, + {"OmitFramePointers", "Oy-", "", "false", 0}, + {"OmitFramePointers", "Oy", "", "true", 0}, + {"EnableFiberSafeOptimizations", "GT", "", "true", 0}, + {"WholeProgramOptimization", "GL", "", "true", 0}, + {"UndefineAllPreprocessorDefinitions", "u", "", "true", 0}, + {"IgnoreStandardIncludePath", "X", "", "true", 0}, + {"PreprocessToFile", "P", "", "true", 0}, + {"PreprocessSuppressLineNumbers", "EP", "", "true", 0}, + {"PreprocessKeepComments", "C", "", "true", 0}, + {"StringPooling", "GF-", "", "false", 0}, + {"StringPooling", "GF", "", "true", 0}, + {"MinimalRebuild", "Gm-", "", "false", 0}, + {"MinimalRebuild", "Gm", "", "true", 0}, + {"SmallerTypeCheck", "RTCc", "", "true", 0}, + {"FunctionLevelLinking", "Gy-", "", "false", 0}, + {"FunctionLevelLinking", "Gy", "", "true", 0}, + {"EnableParallelCodeGeneration", "Qpar-", "", "false", 0}, + {"EnableParallelCodeGeneration", "Qpar", "", "true", 0}, + {"FloatingPointExceptions", "fp:except-", "", "false", 0}, + {"FloatingPointExceptions", "fp:except", "", "true", 0}, + {"CreateHotpatchableImage", "hotpatch", "", "true", 0}, + {"DisableLanguageExtensions", "Za", "", "true", 0}, + {"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0}, + {"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0}, + {"ForceConformanceInForLoopScope", "Zc:forScope-", "", "false", 0}, + {"ForceConformanceInForLoopScope", "Zc:forScope", "", "true", 0}, + {"RuntimeTypeInfo", "GR-", "", "false", 0}, + {"RuntimeTypeInfo", "GR", "", "true", 0}, + {"OpenMPSupport", "openmp-", "", "false", 0}, + {"OpenMPSupport", "openmp", "", "true", 0}, + {"ExpandAttributedSource", "Fx", "", "true", 0}, + {"UseUnicodeForAssemblerListing", "FAu", "", "true", 0}, + {"ShowIncludes", "showIncludes", "", "true", 0}, + {"EnablePREfast", "analyze-", "", "false", 0}, + {"EnablePREfast", "analyze", "", "true", 0}, + {"UseFullPaths", "FC", "", "true", 0}, + {"OmitDefaultLibName", "Zl", "", "true", 0}, + + //Bool Properties With Argument + {"MultiProcessorCompilation", "MP", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"ProcessorNumber", "MP", "Multi-processor Compilation", "", + cmVS7FlagTable::UserValueRequired}, + {"GenerateXMLDocumentationFiles", "doc", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "", + cmVS7FlagTable::UserValueRequired}, + {"BrowseInformation", "FR", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"BrowseInformationFile", "FR", "Enable Browse Information", "", + cmVS7FlagTable::UserValueRequired}, + + //String List Properties + {"AdditionalIncludeDirectories", "I", + "Additional Include Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AdditionalUsingDirectories", "AI", + "Additional #using Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PreprocessorDefinitions", "D ", + "Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"UndefinePreprocessorDefinitions", "U", + "Undefine Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"DisableSpecificWarnings", "wd", + "Disable Specific Warnings", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForcedIncludeFiles", "FI", + "Forced Include File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForcedUsingFiles", "FU", + "Forced #using File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastLog", "analyze:log", + "Code Analysis Log", + "", cmVS7FlagTable::UserFollowing}, + {"PREfastAdditionalPlugins", "analyze:plugin", + "Additional Code Analysis Native plugins", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"TreatSpecificWarningsAsErrors", "we", + "Treat Specific Warnings As Errors", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + // Skip [TrackerLogDirectory] - no command line Switch. + {"PreprocessOutputPath", "Fi", + "Preprocess Output Path", + "", cmVS7FlagTable::UserValue}, + {"PrecompiledHeaderFile", "Yc", + "Precompiled Header Name", + "", cmVS7FlagTable::UserValueRequired}, + {"PrecompiledHeaderFile", "Yu", + "Precompiled Header Name", + "", cmVS7FlagTable::UserValueRequired}, + {"PrecompiledHeaderOutputFile", "Fp", + "Precompiled Header Output File", + "", cmVS7FlagTable::UserValue}, + {"AssemblerListingLocation", "Fa", + "ASM List Location", + "", cmVS7FlagTable::UserValue}, + {"ObjectFileName", "Fo", + "Object File Name", + "", cmVS7FlagTable::UserValue}, + {"ProgramDataBaseFileName", "Fd", + "Program Database File Name", + "", cmVS7FlagTable::UserValue}, + // Skip [XMLDocumentationFileName] - no command line Switch. + // Skip [BrowseInformationFile] - no command line Switch. + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS14LibFlagTable.h b/Source/cmVS14LibFlagTable.h new file mode 100644 index 0000000..a33f273 --- /dev/null +++ b/Source/cmVS14LibFlagTable.h @@ -0,0 +1,102 @@ +static cmVS7FlagTable cmVS14LibFlagTable[] = +{ + + //Enum Properties + {"ErrorReporting", "ERRORREPORT:PROMPT", + "PromptImmediately", "PromptImmediately", 0}, + {"ErrorReporting", "ERRORREPORT:QUEUE", + "Queue For Next Login", "QueueForNextLogin", 0}, + {"ErrorReporting", "ERRORREPORT:SEND", + "Send Error Report", "SendErrorReport", 0}, + {"ErrorReporting", "ERRORREPORT:NONE", + "No Error Report", "NoErrorReport", 0}, + + {"TargetMachine", "MACHINE:ARM", + "MachineARM", "MachineARM", 0}, + {"TargetMachine", "MACHINE:EBC", + "MachineEBC", "MachineEBC", 0}, + {"TargetMachine", "MACHINE:IA64", + "MachineIA64", "MachineIA64", 0}, + {"TargetMachine", "MACHINE:MIPS", + "MachineMIPS", "MachineMIPS", 0}, + {"TargetMachine", "MACHINE:MIPS16", + "MachineMIPS16", "MachineMIPS16", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", + "MachineMIPSFPU", "MachineMIPSFPU", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", + "MachineMIPSFPU16", "MachineMIPSFPU16", 0}, + {"TargetMachine", "MACHINE:SH4", + "MachineSH4", "MachineSH4", 0}, + {"TargetMachine", "MACHINE:THUMB", + "MachineTHUMB", "MachineTHUMB", 0}, + {"TargetMachine", "MACHINE:X64", + "MachineX64", "MachineX64", 0}, + {"TargetMachine", "MACHINE:X86", + "MachineX86", "MachineX86", 0}, + + {"SubSystem", "SUBSYSTEM:CONSOLE", + "Console", "Console", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", + "Windows", "Windows", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", + "Native", "Native", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", + "EFI Application", "EFI Application", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "EFI Boot Service Driver", "EFI Boot Service Driver", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", + "EFI ROM", "EFI ROM", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", + "WindowsCE", "WindowsCE", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", + "POSIX", "POSIX", 0}, + + + //Bool Properties + {"SuppressStartupBanner", "NOLOGO", "", "true", 0}, + {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0}, + {"TreatLibWarningAsErrors", "WX:NO", "", "false", 0}, + {"TreatLibWarningAsErrors", "WX", "", "true", 0}, + {"Verbose", "VERBOSE", "", "true", 0}, + {"LinkTimeCodeGeneration", "LTCG", "", "true", 0}, + + //Bool Properties With Argument + + //String List Properties + // Skip [AdditionalDependencies] - no command line Switch. + {"AdditionalLibraryDirectories", "LIBPATH:", + "Additional Library Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", + "Ignore Specific Default Libraries", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ExportNamedFunctions", "EXPORT:", + "Export Named Functions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"RemoveObjects", "REMOVE:", + "Remove Objects", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + {"OutputFile", "OUT:", + "Output File", + "", cmVS7FlagTable::UserValue}, + {"ModuleDefinitionFile", "DEF:", + "Module Definition File Name", + "", cmVS7FlagTable::UserValue}, + {"ForceSymbolReferences", "INCLUDE:", + "Force Symbol References", + "", cmVS7FlagTable::UserValue}, + {"DisplayLibrary", "LIST:", + "Display Library to standard output", + "", cmVS7FlagTable::UserValue}, + // Skip [MinimumRequiredVersion] - no command line Switch. + {"Name", "NAME:", + "Name", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + // Skip [TrackerLogDirectory] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS14LinkFlagTable.h new file mode 100644 index 0000000..6d81d12 --- /dev/null +++ b/Source/cmVS14LinkFlagTable.h @@ -0,0 +1,340 @@ +static cmVS7FlagTable cmVS14LinkFlagTable[] = +{ + + //Enum Properties + {"ShowProgress", "", + "Not Set", "NotSet", 0}, + {"ShowProgress", "VERBOSE", + "Display all progress messages", "LinkVerbose", 0}, + {"ShowProgress", "VERBOSE:Lib", + "For Libraries Searched", "LinkVerboseLib", 0}, + {"ShowProgress", "VERBOSE:ICF", + "About COMDAT folding during optimized linking", "LinkVerboseICF", 0}, + {"ShowProgress", "VERBOSE:REF", + "About data removed during optimized linking", "LinkVerboseREF", 0}, + {"ShowProgress", "VERBOSE:SAFESEH", + "About Modules incompatible with SEH", "LinkVerboseSAFESEH", 0}, + {"ShowProgress", "VERBOSE:CLR", + "About linker activity related to managed code", "LinkVerboseCLR", 0}, + + {"ForceFileOutput", "FORCE", + "Enabled", "Enabled", 0}, + {"ForceFileOutput", "FORCE:MULTIPLE", + "Multiply Defined Symbol Only", "MultiplyDefinedSymbolOnly", 0}, + {"ForceFileOutput", "FORCE:UNRESOLVED", + "Undefined Symbol Only", "UndefinedSymbolOnly", 0}, + + {"CreateHotPatchableImage", "FUNCTIONPADMIN", + "Enabled", "Enabled", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:5", + "X86 Image Only", "X86Image", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:6", + "X64 Image Only", "X64Image", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:16", + "Itanium Image Only", "ItaniumImage", 0}, + + {"UACExecutionLevel", "level='asInvoker'", + "asInvoker", "AsInvoker", 0}, + {"UACExecutionLevel", "level='highestAvailable'", + "highestAvailable", "HighestAvailable", 0}, + {"UACExecutionLevel", "level='requireAdministrator'", + "requireAdministrator", "RequireAdministrator", 0}, + + {"SubSystem", "", + "Not Set", "NotSet", 0}, + {"SubSystem", "SUBSYSTEM:CONSOLE", + "Console", "Console", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", + "Windows", "Windows", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", + "Native", "Native", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", + "EFI Application", "EFI Application", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "EFI Boot Service Driver", "EFI Boot Service Driver", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", + "EFI ROM", "EFI ROM", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", + "POSIX", "POSIX", 0}, + + {"Driver", "", + "Not Set", "NotSet", 0}, + {"Driver", "Driver", + "Driver", "Driver", 0}, + {"Driver", "DRIVER:UPONLY", + "UP Only", "UpOnly", 0}, + {"Driver", "DRIVER:WDM", + "WDM", "WDM", 0}, + + {"LinkTimeCodeGeneration", "", + "Default", "Default", 0}, + {"LinkTimeCodeGeneration", "LTCG", + "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGInstrument", + "Profile Guided Optimization - Instrument", "PGInstrument", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGOptimize", + "Profile Guided Optimization - Optimization", "PGOptimization", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGUpdate", + "Profile Guided Optimization - Update", "PGUpdate", 0}, + + {"GenerateWindowsMetadata", "WINMD", + "Yes", "true", 0}, + {"GenerateWindowsMetadata", "WINMD:NO", + "No", "false", 0}, + + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA1", + "SHA1", "SHA1", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA256", + "SHA256", "SHA256", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA384", + "SHA384", "SHA384", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA512", + "SHA512", "SHA512", 0}, + + {"TargetMachine", "", + "Not Set", "NotSet", 0}, + {"TargetMachine", "MACHINE:ARM", + "MachineARM", "MachineARM", 0}, + {"TargetMachine", "MACHINE:EBC", + "MachineEBC", "MachineEBC", 0}, + {"TargetMachine", "MACHINE:IA64", + "MachineIA64", "MachineIA64", 0}, + {"TargetMachine", "MACHINE:MIPS", + "MachineMIPS", "MachineMIPS", 0}, + {"TargetMachine", "MACHINE:MIPS16", + "MachineMIPS16", "MachineMIPS16", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", + "MachineMIPSFPU", "MachineMIPSFPU", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", + "MachineMIPSFPU16", "MachineMIPSFPU16", 0}, + {"TargetMachine", "MACHINE:SH4", + "MachineSH4", "MachineSH4", 0}, + {"TargetMachine", "MACHINE:THUMB", + "MachineTHUMB", "MachineTHUMB", 0}, + {"TargetMachine", "MACHINE:X64", + "MachineX64", "MachineX64", 0}, + {"TargetMachine", "MACHINE:X86", + "MachineX86", "MachineX86", 0}, + + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:MTA", + "MTA threading attribute", "MTAThreadingAttribute", 0}, + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:STA", + "STA threading attribute", "STAThreadingAttribute", 0}, + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:NONE", + "Default threading attribute", "DefaultThreadingAttribute", 0}, + + {"CLRImageType", "CLRIMAGETYPE:IJW", + "Force IJW image", "ForceIJWImage", 0}, + {"CLRImageType", "CLRIMAGETYPE:PURE", + "Force Pure IL Image", "ForcePureILImage", 0}, + {"CLRImageType", "CLRIMAGETYPE:SAFE", + "Force Safe IL Image", "ForceSafeILImage", 0}, + {"CLRImageType", "", + "Default image type", "Default", 0}, + + {"SignHash", "CLRSIGNHASH:SHA1", + "SHA1", "SHA1", 0}, + {"SignHash", "CLRSIGNHASH:SHA256", + "SHA256", "SHA256", 0}, + {"SignHash", "CLRSIGNHASH:SHA384", + "SHA384", "SHA384", 0}, + {"SignHash", "CLRSIGNHASH:SHA512", + "SHA512", "SHA512", 0}, + + {"LinkErrorReporting", "ERRORREPORT:PROMPT", + "PromptImmediately", "PromptImmediately", 0}, + {"LinkErrorReporting", "ERRORREPORT:QUEUE", + "Queue For Next Login", "QueueForNextLogin", 0}, + {"LinkErrorReporting", "ERRORREPORT:SEND", + "Send Error Report", "SendErrorReport", 0}, + {"LinkErrorReporting", "ERRORREPORT:NONE", + "No Error Report", "NoErrorReport", 0}, + + {"CLRSupportLastError", "CLRSupportLastError", + "Enabled", "Enabled", 0}, + {"CLRSupportLastError", "CLRSupportLastError:NO", + "Disabled", "Disabled", 0}, + {"CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", + "System Dlls Only", "SystemDlls", 0}, + + + //Bool Properties + {"LinkIncremental", "INCREMENTAL:NO", "", "false", 0}, + {"LinkIncremental", "INCREMENTAL", "", "true", 0}, + {"SuppressStartupBanner", "NOLOGO", "", "true", 0}, + {"LinkStatus", "LTCG:NOSTATUS", "", "false", 0}, + {"LinkStatus", "LTCG:STATUS", "", "true", 0}, + {"PreventDllBinding", "ALLOWBIND:NO", "", "false", 0}, + {"PreventDllBinding", "ALLOWBIND", "", "true", 0}, + {"TreatLinkerWarningAsErrors", "WX:NO", "", "false", 0}, + {"TreatLinkerWarningAsErrors", "WX", "", "true", 0}, + {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0}, + {"GenerateManifest", "MANIFEST:NO", "", "false", 0}, + {"GenerateManifest", "MANIFEST", "", "true", 0}, + {"AllowIsolation", "ALLOWISOLATION:NO", "", "false", 0}, + {"UACUIAccess", "uiAccess='false'", "", "false", 0}, + {"UACUIAccess", "uiAccess='true'", "", "true", 0}, + {"ManifestEmbed", "manifest:embed", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, + {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, + {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, + {"LargeAddressAware", "LARGEADDRESSAWARE:NO", "", "false", 0}, + {"LargeAddressAware", "LARGEADDRESSAWARE", "", "true", 0}, + {"TerminalServerAware", "TSAWARE:NO", "", "false", 0}, + {"TerminalServerAware", "TSAWARE", "", "true", 0}, + {"SwapRunFromCD", "SWAPRUN:CD", "", "true", 0}, + {"SwapRunFromNET", "SWAPRUN:NET", "", "true", 0}, + {"OptimizeReferences", "OPT:NOREF", "", "false", 0}, + {"OptimizeReferences", "OPT:REF", "", "true", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "", "false", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "", "true", 0}, + {"IgnoreEmbeddedIDL", "IGNOREIDL", "", "true", 0}, + {"AppContainer", "APPCONTAINER", "", "true", 0}, + {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN:NO", "", "false", 0}, + {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN", "", "true", 0}, + {"NoEntryPoint", "NOENTRY", "", "true", 0}, + {"SetChecksum", "RELEASE", "", "true", 0}, + {"RandomizedBaseAddress", "DYNAMICBASE:NO", "", "false", 0}, + {"RandomizedBaseAddress", "DYNAMICBASE", "", "true", 0}, + {"FixedBaseAddress", "FIXED:NO", "", "false", 0}, + {"FixedBaseAddress", "FIXED", "", "true", 0}, + {"DataExecutionPrevention", "NXCOMPAT:NO", "", "false", 0}, + {"DataExecutionPrevention", "NXCOMPAT", "", "true", 0}, + {"TurnOffAssemblyGeneration", "NOASSEMBLY", "", "true", 0}, + {"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 0}, + {"SupportNobindOfDelayLoadedDLL", "DELAY:NOBIND", "", "true", 0}, + {"Profile", "PROFILE", "", "true", 0}, + {"LinkDelaySign", "DELAYSIGN:NO", "", "false", 0}, + {"LinkDelaySign", "DELAYSIGN", "", "true", 0}, + {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0}, + {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK", "", "true", 0}, + {"DetectOneDefinitionRule", "ODR", "", "true", 0}, + {"ImageHasSafeExceptionHandlers", "SAFESEH:NO", "", "false", 0}, + {"ImageHasSafeExceptionHandlers", "SAFESEH", "", "true", 0}, + {"LinkDLL", "DLL", "", "true", 0}, + + //Bool Properties With Argument + {"EnableUAC", "MANIFESTUAC:NO", "", "false", 0}, + {"EnableUAC", "MANIFESTUAC:", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "", + cmVS7FlagTable::UserValueRequired}, + {"GenerateMapFile", "MAP", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"MapFileName", "MAP:", "Generate Map File", "", + cmVS7FlagTable::UserValueRequired}, + + //String List Properties + {"AdditionalLibraryDirectories", "LIBPATH:", + "Additional Library Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + // Skip [AdditionalDependencies] - no command line Switch. + {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", + "Ignore Specific Default Libraries", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AddModuleNamesToAssembly", "ASSEMBLYMODULE:", + "Add Module to Assembly", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"EmbedManagedResourceFile", "ASSEMBLYRESOURCE:", + "Embed Managed Resource File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForceSymbolReferences", "INCLUDE:", + "Force Symbol References", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"DelayLoadDLLs", "DELAYLOAD:", + "Delay Loaded Dlls", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AssemblyLinkResource", "ASSEMBLYLINKRESOURCE:", + "Assembly Link Resource", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AdditionalManifestDependencies", "MANIFESTDEPENDENCY:", + "Additional Manifest Dependencies", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ManifestInput", "manifestinput:", + "Manifest Input", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + {"OutputFile", "OUT:", + "Output File", + "", cmVS7FlagTable::UserValue}, + {"Version", "VERSION:", + "Version", + "", cmVS7FlagTable::UserValue}, + {"SpecifySectionAttributes", "SECTION:", + "Specify Section Attributes", + "", cmVS7FlagTable::UserValue}, + {"MSDOSStubFileName", "STUB:", + "MS-DOS Stub File Name", + "", cmVS7FlagTable::UserValue}, + // Skip [TrackerLogDirectory] - no command line Switch. + {"ModuleDefinitionFile", "DEF:", + "Module Definition File", + "", cmVS7FlagTable::UserValue}, + {"ManifestFile", "ManifestFile:", + "Manifest File", + "", cmVS7FlagTable::UserValue}, + {"ProgramDatabaseFile", "PDB:", + "Generate Program Database File", + "", cmVS7FlagTable::UserValue}, + {"StripPrivateSymbols", "PDBSTRIPPED:", + "Strip Private Symbols", + "", cmVS7FlagTable::UserValue}, + // Skip [MapFileName] - no command line Switch. + // Skip [MinimumRequiredVersion] - no command line Switch. + {"HeapReserveSize", "HEAP:", + "Heap Reserve Size", + "", cmVS7FlagTable::UserValue}, + // Skip [HeapCommitSize] - no command line Switch. + {"StackReserveSize", "STACK:", + "Stack Reserve Size", + "", cmVS7FlagTable::UserValue}, + // Skip [StackCommitSize] - no command line Switch. + {"FunctionOrder", "ORDER:@", + "Function Order", + "", cmVS7FlagTable::UserValue}, + {"ProfileGuidedDatabase", "PGD:", + "Profile Guided Database", + "", cmVS7FlagTable::UserValue}, + {"MidlCommandFile", "MIDL:@", + "MIDL Commands", + "", cmVS7FlagTable::UserValue}, + {"MergedIDLBaseFileName", "IDLOUT:", + "Merged IDL Base File Name", + "", cmVS7FlagTable::UserValue}, + {"TypeLibraryFile", "TLBOUT:", + "Type Library", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataFile", "WINMDFILE:", + "Windows Metadata File", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataLinkKeyFile", "WINMDKEYFILE:", + "Windows Metadata Key File", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataKeyContainer", "WINMDKEYCONTAINER:", + "Windows Metadata Key Container", + "", cmVS7FlagTable::UserValue}, + {"EntryPointSymbol", "ENTRY:", + "Entry Point", + "", cmVS7FlagTable::UserValue}, + {"BaseAddress", "BASE:", + "Base Address", + "", cmVS7FlagTable::UserValue}, + {"ImportLibrary", "IMPLIB:", + "Import Library", + "", cmVS7FlagTable::UserValue}, + {"MergeSections", "MERGE:", + "Merge Sections", + "", cmVS7FlagTable::UserValue}, + {"LinkKeyFile", "KEYFILE:", + "Key File", + "", cmVS7FlagTable::UserValue}, + {"KeyContainer", "KEYCONTAINER:", + "Key Container", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index acf3930..1e09ed9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -29,6 +29,9 @@ #include "cmVS12CLFlagTable.h" #include "cmVS12LinkFlagTable.h" #include "cmVS12LibFlagTable.h" +#include "cmVS14CLFlagTable.h" +#include "cmVS14LinkFlagTable.h" +#include "cmVS14LibFlagTable.h" #include <cmsys/auto_ptr.hxx> @@ -36,7 +39,9 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const { cmLocalVisualStudioGenerator::VSVersion v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS12) + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14CLFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) { return cmVS12CLFlagTable; } else if(v == cmLocalVisualStudioGenerator::VS11) { return cmVS11CLFlagTable; } @@ -48,7 +53,9 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const { cmLocalVisualStudioGenerator::VSVersion v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS12) + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14LibFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) { return cmVS12LibFlagTable; } else if(v == cmLocalVisualStudioGenerator::VS11) { return cmVS11LibFlagTable; } @@ -60,7 +67,9 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const { cmLocalVisualStudioGenerator::VSVersion v = this->LocalGenerator->GetVersion(); - if(v >= cmLocalVisualStudioGenerator::VS12) + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14LinkFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) { return cmVS12LinkFlagTable; } else if(v == cmLocalVisualStudioGenerator::VS11) { return cmVS11LinkFlagTable; } diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 81adb56..2cbf5db 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -68,6 +68,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() case cmLocalVisualStudioGenerator::VS10: case cmLocalVisualStudioGenerator::VS11: case cmLocalVisualStudioGenerator::VS12: + case cmLocalVisualStudioGenerator::VS14: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 86d3766..a051c87 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -58,6 +58,7 @@ # include "cmGlobalVisualStudio10Generator.h" # include "cmGlobalVisualStudio11Generator.h" # include "cmGlobalVisualStudio12Generator.h" +# include "cmGlobalVisualStudio14Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" @@ -1380,6 +1381,7 @@ int cmake::ActualConfigure() {"10.0", "Visual Studio 10 2010"}, {"11.0", "Visual Studio 11 2012"}, {"12.0", "Visual Studio 12 2013"}, + {"14.0", "Visual Studio 14"}, {0, 0}}; for(int i=0; version[i].MSVersion != 0; i++) { @@ -1779,6 +1781,8 @@ void cmake::AddDefaultGenerators() this->Generators.push_back( cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back( + cmGlobalVisualStudio14Generator::NewFactory()); + this->Generators.push_back( cmGlobalVisualStudio71Generator::NewFactory()); this->Generators.push_back( cmGlobalVisualStudio8Generator::NewFactory()); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9aee975..a0c67e0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -61,6 +61,8 @@ void CMakeCommandUsage(const char* program) << " echo [string]... - displays arguments as text\n" << " echo_append [string]... - displays arguments as text but no new " "line\n" + << " env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...\n" + << " - run command in a modified environment\n" << " environment - display the current environment\n" << " make_directory dir - create a directory\n" << " md5sum file1 [...] - compute md5sum of files\n" @@ -190,6 +192,55 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 0; } + else if (args[1] == "env" ) + { + std::vector<std::string>::const_iterator ai = args.begin() + 2; + std::vector<std::string>::const_iterator ae = args.end(); + for(; ai != ae; ++ai) + { + std::string const& a = *ai; + if(cmHasLiteralPrefix(a, "--unset=")) + { + // Unset environment variable. + cmSystemTools::UnPutEnv(a.c_str() + 8); + } + else if(!a.empty() && a[0] == '-') + { + // Environment variable and command names cannot start in '-', + // so this must be an unknown option. + std::cerr << "cmake -E env: unknown option '" << a << "'" + << std::endl; + return 1; + } + else if(a.find("=") != a.npos) + { + // Set environment variable. + cmSystemTools::PutEnv(a.c_str()); + } + else + { + // This is the beginning of the command. + break; + } + } + + if(ai == ae) + { + std::cerr << "cmake -E env: no command given" << std::endl; + return 1; + } + + // Execute command from remaining arguments. + std::vector<std::string> cmd(ai, ae); + int retval; + if(cmSystemTools::RunSingleCommand( + cmd, 0, &retval, NULL, cmSystemTools::OUTPUT_PASSTHROUGH)) + { + return retval; + } + return 1; + } + #if defined(CMAKE_BUILD_WITH_CMAKE) // Command to create a symbolic link. Fails on platforms not // supporting them. diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index d1b61ef..056a0db 100755 --- a/Source/cmparseMSBuildXML.py +++ b/Source/cmparseMSBuildXML.py @@ -12,6 +12,9 @@ # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/cl.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/lib.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/link.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/cl.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/lib.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/link.xml" # # BoolProperty <Name>true|false</Name> # simple example: diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 273a541..cf7bd75 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2549,7 +2549,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if (CMAKE_TESTS_CDASH_SERVER) - set(regex "^([^:]+)://([^/]+)(/.*)$") + set(regex "^([^:]+)://([^/]+)(.*)$") if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") set(protocol "${CMAKE_MATCH_1}") @@ -2557,8 +2557,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(path "${CMAKE_MATCH_3}") else () set(protocol "http") - set(server "www.cdash.org") - set(path "/CDash") + set(server "open.cdash.org") + set(path "") message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...") message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]") endif () diff --git a/Tests/CTestTestBadExe/CTestConfig.cmake b/Tests/CTestTestBadExe/CTestConfig.cmake index 1d46ea3..c7286e2 100644 --- a/Tests/CTestTestBadExe/CTestConfig.cmake +++ b/Tests/CTestTestBadExe/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestBadExe") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestBadGenerator/CTestConfig.cmake b/Tests/CTestTestBadGenerator/CTestConfig.cmake index ef98189..1e61bf4 100644 --- a/Tests/CTestTestBadGenerator/CTestConfig.cmake +++ b/Tests/CTestTestBadGenerator/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestBadGenerator") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake index d2c28f9..4458348 100644 --- a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake +++ b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestConfigFileInBuildDir") set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCostSerial/CTestConfig.cmake b/Tests/CTestTestCostSerial/CTestConfig.cmake index 05c20eb..3ab99ac 100644 --- a/Tests/CTestTestCostSerial/CTestConfig.cmake +++ b/Tests/CTestTestCostSerial/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestCostSerial") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCrash/CTestConfig.cmake b/Tests/CTestTestCrash/CTestConfig.cmake index e1c5b1b..5c2ca0e 100644 --- a/Tests/CTestTestCrash/CTestConfig.cmake +++ b/Tests/CTestTestCrash/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestCrash") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestCycle/CTestConfig.cmake b/Tests/CTestTestCycle/CTestConfig.cmake index 43e9986..8aeb09b 100644 --- a/Tests/CTestTestCycle/CTestConfig.cmake +++ b/Tests/CTestTestCycle/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestCycle") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestDepends/CTestConfig.cmake b/Tests/CTestTestDepends/CTestConfig.cmake index e3af7dd..7af9200 100644 --- a/Tests/CTestTestDepends/CTestConfig.cmake +++ b/Tests/CTestTestDepends/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestDepends") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestFailure/CTestConfig.cmake b/Tests/CTestTestFailure/CTestConfig.cmake index fd8d97a..07e1be0 100644 --- a/Tests/CTestTestFailure/CTestConfig.cmake +++ b/Tests/CTestTestFailure/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestFailure") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake index bf404ab..669b0fb 100644 --- a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake +++ b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake @@ -3,6 +3,6 @@ set(CTEST_PROJECT_NAME "CTestTestLaunchers") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/CTestConfig.cmake.in b/Tests/CTestTestMemcheck/CTestConfig.cmake.in index 6cf3782..19c76c2 100644 --- a/Tests/CTestTestMemcheck/CTestConfig.cmake.in +++ b/Tests/CTestTestMemcheck/CTestConfig.cmake.in @@ -2,8 +2,8 @@ set (CTEST_PROJECT_NAME "CTestTestMemcheck@SUBTEST_NAME@") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) @CTEST_EXTRA_CONFIG@ diff --git a/Tests/CTestTestParallel/CTestConfig.cmake b/Tests/CTestTestParallel/CTestConfig.cmake index c3c5038..fc5b666 100644 --- a/Tests/CTestTestParallel/CTestConfig.cmake +++ b/Tests/CTestTestParallel/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestParallel") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestResourceLock/CTestConfig.cmake b/Tests/CTestTestResourceLock/CTestConfig.cmake index 5fb560b..c118777 100644 --- a/Tests/CTestTestResourceLock/CTestConfig.cmake +++ b/Tests/CTestTestResourceLock/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestResourceLock") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestScheduler/CTestConfig.cmake b/Tests/CTestTestScheduler/CTestConfig.cmake index 7da8f6f..797387b 100644 --- a/Tests/CTestTestScheduler/CTestConfig.cmake +++ b/Tests/CTestTestScheduler/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestScheduler") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake index ad8e00e..da0c76b 100644 --- a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake +++ b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestSkipReturnCode") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestStopTime/CTestConfig.cmake b/Tests/CTestTestStopTime/CTestConfig.cmake index 129db4d..412283e 100644 --- a/Tests/CTestTestStopTime/CTestConfig.cmake +++ b/Tests/CTestTestStopTime/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestStopTime") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestSubdir/CTestConfig.cmake b/Tests/CTestTestSubdir/CTestConfig.cmake index 4b848aa..47ebb92 100644 --- a/Tests/CTestTestSubdir/CTestConfig.cmake +++ b/Tests/CTestTestSubdir/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestSubdir") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestTimeout/CMakeLists.txt b/Tests/CTestTestTimeout/CMakeLists.txt index 2e3bd6a..c6cbc47 100644 --- a/Tests/CTestTestTimeout/CMakeLists.txt +++ b/Tests/CTestTestTimeout/CMakeLists.txt @@ -3,11 +3,8 @@ project(CTestTestTimeout) include(CTest) if(NOT TIMEOUT) - if(CYGWIN) - set(TIMEOUT 4) # Cygwin CMake sometimes takes > 1 second to load! - else() - set(TIMEOUT 1) - endif() + # Give the process time to load and start running. + set(TIMEOUT 4) endif() add_definitions(-DTIMEOUT=${TIMEOUT}) diff --git a/Tests/CTestTestTimeout/CTestConfig.cmake b/Tests/CTestTestTimeout/CTestConfig.cmake index 76d62ad..13114f1 100644 --- a/Tests/CTestTestTimeout/CTestConfig.cmake +++ b/Tests/CTestTestTimeout/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestTimeout") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestUpload/CTestConfig.cmake b/Tests/CTestTestUpload/CTestConfig.cmake index 89c5b94..a547088 100644 --- a/Tests/CTestTestUpload/CTestConfig.cmake +++ b/Tests/CTestTestUpload/CTestConfig.cmake @@ -2,6 +2,6 @@ set (CTEST_PROJECT_NAME "CTestTestUpload") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set (CTEST_DROP_METHOD "http") -set (CTEST_DROP_SITE "www.cdash.org") -set (CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set (CTEST_DROP_SITE "open.cdash.org") +set (CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set (CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestZeroTimeout/CTestConfig.cmake b/Tests/CTestTestZeroTimeout/CTestConfig.cmake index f8e0609..6094864 100644 --- a/Tests/CTestTestZeroTimeout/CTestConfig.cmake +++ b/Tests/CTestTestZeroTimeout/CTestConfig.cmake @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "CTestTestZeroTimeout") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 69cfdb8..87b7f1a 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -40,6 +40,9 @@ endif() if(DEFINED MSVC12) math(EXPR msvc_total "${msvc_total} + 1") endif() +if(DEFINED MSVC14) + math(EXPR msvc_total "${msvc_total} + 1") +endif() echo_var(MSVC) echo_var(MSVC60) @@ -50,6 +53,7 @@ echo_var(MSVC90) echo_var(MSVC10) echo_var(MSVC11) echo_var(MSVC12) +echo_var(MSVC14) echo_var(MSVC_IDE) if(MSVC) diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index 81b34e6..d4f49c2 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -8,8 +8,18 @@ target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE) add_subdirectory(headerdir) +# Add an interface target in a subdirectory that uses an imported interface. +add_subdirectory(ifacedir) + +# Poison an imported interface with the same name as that in the subdir +# to ensure that the transitive lookup occurs in the subdir. +add_library(imp::iface INTERFACE IMPORTED) +set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP OFF) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist.cpp) + add_executable(InterfaceLibrary definetestexe.cpp) -target_link_libraries(InterfaceLibrary iface_nodepends headeriface) +target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface) add_subdirectory(libsdir) diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp index e7a10c1..30f2925 100644 --- a/Tests/InterfaceLibrary/definetestexe.cpp +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -15,7 +15,9 @@ #error Expected IFACE_HEADER_BUILDDIR #endif +extern int sub(); + int main(int,char**) { - return 0; + return sub(); } diff --git a/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt b/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt new file mode 100644 index 0000000..228715e --- /dev/null +++ b/Tests/InterfaceLibrary/ifacedir/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(imp::iface INTERFACE IMPORTED) +set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP ON) +set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sub.cpp) + +add_library(subiface INTERFACE) +target_link_libraries(subiface INTERFACE imp::iface) +set_property(TARGET subiface PROPERTY INTERFACE_SOMEPROP ON) diff --git a/Tests/InterfaceLibrary/ifacedir/sub.cpp b/Tests/InterfaceLibrary/ifacedir/sub.cpp new file mode 100644 index 0000000..165a66a --- /dev/null +++ b/Tests/InterfaceLibrary/ifacedir/sub.cpp @@ -0,0 +1 @@ +int sub() { return 0; } diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index c933798..03a3b49 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -8,10 +8,6 @@ include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(char SIZEOF_CHAR) CHECK_TYPE_SIZE(short SIZEOF_SHORT) -include (CheckFunctionExists) -CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) -CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) - configure_file(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in ${LoadCommand_BINARY_DIR}/LoadedCommand.h) diff --git a/Tests/LoadCommand/LoadedCommand.cxx.in b/Tests/LoadCommand/LoadedCommand.cxx.in index c58bcf1..72ec014 100644 --- a/Tests/LoadCommand/LoadedCommand.cxx.in +++ b/Tests/LoadCommand/LoadedCommand.cxx.in @@ -9,15 +9,6 @@ int testSizeOf(int s1, int s2) int main () { int ret = 0; -#ifdef HAVE_VSBLABLA - printf("Should not be able to find vsblabla\n"); - ret = 1; -#endif - -#if !defined( HAVE_PRINTF ) - printf("Should be able to find printf\n"); - ret= 1; -#endif #if !defined( ADDED_DEFINITION ) printf("Should have ADDED_DEFINITION defined\n"); diff --git a/Tests/LoadCommand/LoadedCommand.h.in b/Tests/LoadCommand/LoadedCommand.h.in index 7516a66..733c414 100644 --- a/Tests/LoadCommand/LoadedCommand.h.in +++ b/Tests/LoadCommand/LoadedCommand.h.in @@ -1,7 +1,3 @@ /* Check for size of types */ #cmakedefine SIZEOF_CHAR ${SIZEOF_CHAR} #cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT} - -/* Check for functions */ -#cmakedefine HAVE_PRINTF -#cmakedefine HAVE_VSBLABLA diff --git a/Tests/LoadCommandOneConfig/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeLists.txt index a75ad5a..6affd34 100644 --- a/Tests/LoadCommandOneConfig/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeLists.txt @@ -8,10 +8,6 @@ include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(char SIZEOF_CHAR) CHECK_TYPE_SIZE(short SIZEOF_SHORT) -include (CheckFunctionExists) -CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) -CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) - include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) CHECK_INCLUDE_FILE("sys/prctl.h" HAVE_SYS_PRCTL_H) diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in b/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in index c58bcf1..72ec014 100644 --- a/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in +++ b/Tests/LoadCommandOneConfig/LoadedCommand.cxx.in @@ -9,15 +9,6 @@ int testSizeOf(int s1, int s2) int main () { int ret = 0; -#ifdef HAVE_VSBLABLA - printf("Should not be able to find vsblabla\n"); - ret = 1; -#endif - -#if !defined( HAVE_PRINTF ) - printf("Should be able to find printf\n"); - ret= 1; -#endif #if !defined( ADDED_DEFINITION ) printf("Should have ADDED_DEFINITION defined\n"); diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.h.in b/Tests/LoadCommandOneConfig/LoadedCommand.h.in index 7a0a15d..d748d06 100644 --- a/Tests/LoadCommandOneConfig/LoadedCommand.h.in +++ b/Tests/LoadCommandOneConfig/LoadedCommand.h.in @@ -2,10 +2,6 @@ #cmakedefine SIZEOF_CHAR ${SIZEOF_CHAR} #cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT} -/* Check for functions */ -#cmakedefine HAVE_PRINTF -#cmakedefine HAVE_VSBLABLA - /* Check for headers */ #cmakedefine HAVE_SYS_PRCTL_H diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index d44cb9c..cdfdcc1 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -34,15 +34,6 @@ endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") set(PP_VS 1) endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 10") - set(PP_VS100 1) -endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 11") - set(PP_VS110 1) -endif() -if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 12") - set(PP_VS120 1) -endif() # Some tests below check the PP_* variables set above. They are meant # to test the case that the build tool is at fault. Other tests below diff --git a/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt b/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-bad-arg1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt new file mode 100644 index 0000000..2143ba4 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-bad-arg1-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: unknown option '-bad-arg1'$ diff --git a/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt b/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt b/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt new file mode 100644 index 0000000..d2efa53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command0-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: no command given$ diff --git a/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt b/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt b/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt new file mode 100644 index 0000000..d2efa53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-no-command1-stderr.txt @@ -0,0 +1 @@ +^cmake -E env: no command given$ diff --git a/Tests/RunCMake/CommandLine/E_env-set-stdout.txt b/Tests/RunCMake/CommandLine/E_env-set-stdout.txt new file mode 100644 index 0000000..feff117 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-set-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly set in environment: 1$ diff --git a/Tests/RunCMake/CommandLine/E_env-set.cmake b/Tests/RunCMake/CommandLine/E_env-set.cmake new file mode 100644 index 0000000..c2639b6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-set.cmake @@ -0,0 +1,5 @@ +if(DEFINED ENV{TEST_ENV}) + message(STATUS "TEST_ENV is correctly set in environment: $ENV{TEST_ENV}") +else() + message(FATAL_ERROR "TEST_ENV is incorrectly not set in environment") +endif() diff --git a/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt new file mode 100644 index 0000000..a1d5c01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-unset-stdout.txt @@ -0,0 +1 @@ +^-- TEST_ENV is correctly not set in environment$ diff --git a/Tests/RunCMake/CommandLine/E_env-unset.cmake b/Tests/RunCMake/CommandLine/E_env-unset.cmake new file mode 100644 index 0000000..04976fb --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-unset.cmake @@ -0,0 +1,5 @@ +if(DEFINED ENV{TEST_ENV}) + message(FATAL_ERROR "TEST_ENV is incorrectly set in environment") +else() + message(STATUS "TEST_ENV is correctly not set in environment") +endif() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f3d9637..5622a5b 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -31,6 +31,12 @@ if(UNIX) ) endif() +run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) +run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) +run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) +run_cmake_command(E_env-set ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) +run_cmake_command(E_env-unset ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -E env --unset=TEST_ENV ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) + run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep) run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x) run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) diff --git a/Tests/RunCMake/File_Generate/CMakeLists.txt b/Tests/RunCMake/File_Generate/CMakeLists.txt index 12cd3c7..bc0cf5d 100644 --- a/Tests/RunCMake/File_Generate/CMakeLists.txt +++ b/Tests/RunCMake/File_Generate/CMakeLists.txt @@ -1,3 +1,6 @@ cmake_minimum_required(VERSION 2.8.4) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +if(NOT TEST_FILE) + set(TEST_FILE ${RunCMake_TEST}.cmake) +endif() +include(${TEST_FILE}) diff --git a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt index 9fe39cc..e823b25 100644 --- a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt +++ b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt @@ -1,4 +1,4 @@ CMake Error at EmptyCondition1.cmake:2 \(file\): file Incorrect arguments to GENERATE subcommand. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/EmptyCondition2-stderr.txt b/Tests/RunCMake/File_Generate/EmptyCondition2-stderr.txt index 73d5f25..b042946 100644 --- a/Tests/RunCMake/File_Generate/EmptyCondition2-stderr.txt +++ b/Tests/RunCMake/File_Generate/EmptyCondition2-stderr.txt @@ -1,4 +1,4 @@ CMake Error at EmptyCondition2.cmake:2 \(file\): file CONDITION of sub-command GENERATE must not be empty if specified. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index f23fa19..f74d17e 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -12,10 +12,10 @@ run_cmake(DebugEvaluate) set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") -set(RunCMake_TEST_FILE "WriteIfDifferent") +set(RunCMake_TEST_OPTIONS "-DTEST_FILE=WriteIfDifferent.cmake") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/WriteIfDifferent-build") run_cmake(WriteIfDifferent-prepare) -unset(RunCMake_TEST_FILE) +unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_BINARY_DIR) file(TIMESTAMP "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt" timestamp ${timeformat}) if(NOT timestamp) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index d39f33f..6220657 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_TOOLSET "") run_cmake(NoToolset) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[0124]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) else() @@ -17,7 +17,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[0124]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) run_cmake(TestToolsetToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 4ed2f43..2020356 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -38,9 +38,6 @@ function(run_cmake test) if(NOT DEFINED RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS "") endif() - if (NOT RunCMake_TEST_FILE) - set(RunCMake_TEST_FILE "${test}") - endif() if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() @@ -57,7 +54,7 @@ function(run_cmake test) COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" -G "${RunCMake_GENERATOR}" -T "${RunCMake_GENERATOR_TOOLSET}" - -DRunCMake_TEST=${RunCMake_TEST_FILE} + -DRunCMake_TEST=${test} --no-warn-unused-cli ${RunCMake_TEST_OPTIONS} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" diff --git a/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt b/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt new file mode 100644 index 0000000..561a6b1 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-DIRECTORY-stdout.txt @@ -0,0 +1,8 @@ +-- Before Installing +-- Installing: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Installing: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir +-- Up-to-date: .*/Tests/RunCMake/file/INSTALL-DIRECTORY-build/dir/empty.txt +-- After Installing diff --git a/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake b/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake new file mode 100644 index 0000000..0bc1d18 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-DIRECTORY.cmake @@ -0,0 +1,10 @@ +set(src ${CMAKE_CURRENT_SOURCE_DIR}/dir) +set(dst ${CMAKE_CURRENT_BINARY_DIR}/dir) +file(REMOVE RECURSE ${dst}) +message(STATUS "Before Installing") +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_NEVER) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_LAZY) +file(INSTALL FILES ${src}/ DESTINATION ${dst} TYPE DIRECTORY MESSAGE_ALWAYS) +message(STATUS "After Installing") diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt new file mode 100644 index 0000000..557b817 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad-stderr.txt @@ -0,0 +1,32 @@ +CMake Error at INSTALL-MESSAGE-bad.cmake:1 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:2 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:3 \(file\): + file INSTALL options MESSAGE_ALWAYS, MESSAGE_LAZY, and MESSAGE_NEVER are + mutually exclusive. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:4 \(file\): + file option MESSAGE_ALWAYS may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:5 \(file\): + file option MESSAGE_LAZY may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at INSTALL-MESSAGE-bad.cmake:6 \(file\): + file option MESSAGE_NEVER may not appear after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake b/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake new file mode 100644 index 0000000..f878c69 --- /dev/null +++ b/Tests/RunCMake/file/INSTALL-MESSAGE-bad.cmake @@ -0,0 +1,6 @@ +file(INSTALL DESTINATION dir MESSAGE_ALWAYS MESSAGE_LAZY) +file(INSTALL DESTINATION dir MESSAGE_ALWAYS MESSAGE_NEVER) +file(INSTALL DESTINATION dir MESSAGE_LAZY MESSAGE_NEVER) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_ALWAYS) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_LAZY) +file(INSTALL DESTINATION dir PATTERN *.txt MESSAGE_NEVER) diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 7b05229..bf14263 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -1,3 +1,5 @@ include(RunCMake) +run_cmake(INSTALL-DIRECTORY) +run_cmake(INSTALL-MESSAGE-bad) run_cmake(FileOpenFailRead) diff --git a/Tests/RunCMake/file/dir/empty.txt b/Tests/RunCMake/file/dir/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/dir/empty.txt diff --git a/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake b/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake index 8754540..67ee7de 100644 --- a/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake +++ b/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake @@ -1,5 +1,5 @@ -project(BinaryDirectoryInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/foo") diff --git a/Tests/RunCMake/include_directories/CMakeLists.txt b/Tests/RunCMake/include_directories/CMakeLists.txt index 3482e6b..5cd4825 100644 --- a/Tests/RunCMake/include_directories/CMakeLists.txt +++ b/Tests/RunCMake/include_directories/CMakeLists.txt @@ -1,3 +1,6 @@ cmake_minimum_required(VERSION 3.0) -project(${RunCMake_TEST} CXX) -include(${RunCMake_TEST}.cmake) +project(${RunCMake_TEST} NONE) +if(NOT TEST_FILE) + set(TEST_FILE ${RunCMake_TEST}.cmake) +endif() +include(${TEST_FILE}) diff --git a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt index 71e6456..8dff90f 100644 --- a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt +++ b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt @@ -5,7 +5,7 @@ CMake Debug Log at DebugIncludes.cmake:8 \(include_directories\): \* .*/Tests/RunCMake/include_directories/two Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:13 \(set_property\): Used includes for target lll: @@ -13,7 +13,7 @@ CMake Debug Log at DebugIncludes.cmake:13 \(set_property\): \* .*/Tests/RunCMake/include_directories/three Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\): Used includes for target lll: @@ -21,7 +21,7 @@ CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\): \* .*/Tests/RunCMake/include_directories/four Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:33 \(set_property\): Used includes for target lll: @@ -33,7 +33,7 @@ CMake Debug Log at DebugIncludes.cmake:33 \(set_property\): Call Stack \(most recent call first\): DebugIncludes.cmake:44 \(some_macro\) DebugIncludes.cmake:47 \(some_function\) - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\): Used includes for target lll: @@ -41,7 +41,7 @@ CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\): \* .*/Tests/RunCMake/include_directories/eight Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + CMake Debug Log at DebugIncludes.cmake:55 \(set_property\): Used includes for target lll: @@ -50,4 +50,4 @@ CMake Debug Log at DebugIncludes.cmake:55 \(set_property\): \* .*/Tests/RunCMake/include_directories/ten Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/include_directories/DebugIncludes.cmake b/Tests/RunCMake/include_directories/DebugIncludes.cmake index bbc9e46..10a4c50 100644 --- a/Tests/RunCMake/include_directories/DebugIncludes.cmake +++ b/Tests/RunCMake/include_directories/DebugIncludes.cmake @@ -1,5 +1,5 @@ -project(DebugIncludes) +enable_language(CXX) set(CMAKE_DEBUG_TARGET_PROPERTIES INCLUDE_DIRECTORIES) diff --git a/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake b/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake index d6f08bd..fab7717 100644 --- a/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake +++ b/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(testTarget empty.cpp) target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/dir") diff --git a/Tests/RunCMake/include_directories/ImportedTarget.cmake b/Tests/RunCMake/include_directories/ImportedTarget.cmake index e1a20b1..f752f98 100644 --- a/Tests/RunCMake/include_directories/ImportedTarget.cmake +++ b/Tests/RunCMake/include_directories/ImportedTarget.cmake @@ -1,5 +1,5 @@ -project(ImportedTarget) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake b/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake index 0f08e58..8d777f5 100644 --- a/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake +++ b/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake @@ -1,5 +1,5 @@ -project(InstallPrefixInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/foo") diff --git a/Tests/RunCMake/include_directories/RelativePathInGenex.cmake b/Tests/RunCMake/include_directories/RelativePathInGenex.cmake index f72cf3a..070a381 100644 --- a/Tests/RunCMake/include_directories/RelativePathInGenex.cmake +++ b/Tests/RunCMake/include_directories/RelativePathInGenex.cmake @@ -1,5 +1,5 @@ -project(RelativePathInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") diff --git a/Tests/RunCMake/include_directories/RelativePathInInterface.cmake b/Tests/RunCMake/include_directories/RelativePathInInterface.cmake index f2ce54a..4c4727d 100644 --- a/Tests/RunCMake/include_directories/RelativePathInInterface.cmake +++ b/Tests/RunCMake/include_directories/RelativePathInInterface.cmake @@ -1,5 +1,5 @@ -project(RelativePathInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo") diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index c5b29d0..fa76f24 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -31,19 +31,22 @@ configure_file( "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" COPYONLY ) -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix") -set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" + ) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy") run_cmake(InstallInSrcDir) unset(RunCMake_TEST_SOURCE_DIR) -unset(RunCMake_TEST_FILE) set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix" + "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" + ) set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/InstallInBinDir-build") -set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface") run_cmake(InstallInBinDir) unset(RunCMake_TEST_BINARY_DIR) -unset(RunCMake_TEST_FILE) configure_file( "${RunCMake_SOURCE_DIR}/CMakeLists.txt" @@ -68,22 +71,25 @@ foreach(policyStatus "" NEW OLD) unset(policyOption) set(policyStatus WARN) endif() - set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} + "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" + ) # Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run # the test suite in-source properly. Otherwise the install directory would be # a subdirectory or the source directory, which is allowed and tested separately # below. set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build") - set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface") run_cmake(BinInInstallPrefix-CMP0052-${policyStatus}) unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_FILE) - set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface") + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} + "-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" + ) run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus}) unset(RunCMake_TEST_SOURCE_DIR) - unset(RunCMake_TEST_FILE) endforeach() set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix") @@ -104,12 +110,13 @@ configure_file( "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" COPYONLY ) -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix") -set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" + ) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrc") run_cmake(InstallToPrefixInSrcDirOutOfSource) unset(RunCMake_TEST_SOURCE_DIR) -unset(RunCMake_TEST_FILE) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/installToSrcInSrc") @@ -131,12 +138,13 @@ configure_file( COPYONLY ) -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix") -set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake" + ) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") run_cmake(InstallToPrefixInSrcDirInSource) unset(RunCMake_TEST_SOURCE_DIR) unset(RunCMake_TEST_BINARY_DIR) -unset(RunCMake_TEST_FILE) unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake b/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake index c9a9c45..f814a3c 100644 --- a/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake +++ b/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake @@ -1,5 +1,5 @@ -project(SourceDirectoryInInterface) +enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/foo") diff --git a/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt b/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt index 481e358..4e15de1 100644 --- a/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt +++ b/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt @@ -1,4 +1,4 @@ CMake Error at TID-bad-target.cmake:6 \(target_include_directories\): target_include_directories called with non-compilable target type Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/include_directories/export-NOWARN.cmake b/Tests/RunCMake/include_directories/export-NOWARN.cmake index 307ce5a..50720a0 100644 --- a/Tests/RunCMake/include_directories/export-NOWARN.cmake +++ b/Tests/RunCMake/include_directories/export-NOWARN.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library(foo empty.cpp) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<0:>/include/subdir) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_PREFIX>/include/subdir) diff --git a/Tests/RunCMake/include_directories/incomplete-genex.cmake b/Tests/RunCMake/include_directories/incomplete-genex.cmake index b6900a4..976695a 100644 --- a/Tests/RunCMake/include_directories/incomplete-genex.cmake +++ b/Tests/RunCMake/include_directories/incomplete-genex.cmake @@ -1,4 +1,4 @@ -project(incomplete-genex) +enable_language(CXX) cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0023 NEW) diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake new file mode 100644 index 0000000..2c716e1 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake @@ -0,0 +1,13 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +if(out MATCHES "-- Installing: [^\n]*prefix/dir") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Installation output was not quiet:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake new file mode 100644 index 0000000..eefb837 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "ALWAYS") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir MESSAGE_NEVER) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt new file mode 100644 index 0000000..166ba6f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at DIRECTORY-PATTERN-MESSAGE_NEVER.cmake:[0-9]+ \(install\): + install DIRECTORY does not allow "MESSAGE_NEVER" after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake new file mode 100644 index 0000000..de844f7 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake @@ -0,0 +1 @@ +install(DIRECTORY src DESTINATION src PATTERN *.txt MESSAGE_NEVER) diff --git a/Tests/RunCMake/install/DIRECTORY-message-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-check.cmake new file mode 100644 index 0000000..857681f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-check.cmake @@ -0,0 +1,28 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Installing: [^\n]*/prefix/dir\r? +-- Installing: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}First install did not say 'Installing' as expected:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Up-to-date: [^\n]*/prefix/dir\r? +-- Up-to-date: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Second install did not say 'Up-to-date' as expected:\n${out}") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake new file mode 100644 index 0000000..c7e6018 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake @@ -0,0 +1,24 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix) +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +set(expect " +-- Installing: [^\n]*/prefix/dir\r? +-- Installing: [^\n]*/prefix/dir/empty.txt\r? +") +if(NOT out MATCHES "${expect}") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}First install did not say 'Installing' as expected:\n${out}") +endif() +set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt) +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n") +endif() +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +if(out MATCHES "(Installing|Up-to-date)") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Second install was not silent as expected:\n${out}") +endif() diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake new file mode 100644 index 0000000..ed43567 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "LAZY") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir) diff --git a/Tests/RunCMake/install/DIRECTORY-message.cmake b/Tests/RunCMake/install/DIRECTORY-message.cmake new file mode 100644 index 0000000..913ed15 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-message.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "ALWAYS") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index c8dc379..53b91f3 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -1,4 +1,8 @@ include(RunCMake) +run_cmake(DIRECTORY-MESSAGE_NEVER) +run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER) +run_cmake(DIRECTORY-message) +run_cmake(DIRECTORY-message-lazy) run_cmake(SkipInstallRulesWarning) run_cmake(SkipInstallRulesNoWarning1) run_cmake(SkipInstallRulesNoWarning2) diff --git a/Tests/RunCMake/install/dir/empty.txt b/Tests/RunCMake/install/dir/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/dir/empty.txt diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index 8fc2871..cfcccec 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -6,7 +6,7 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") else() set(PROJECT_EXT vcproj) endif() -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") set(PROJECT_EXT vcxproj) endif() @@ -54,7 +54,7 @@ add_dependencies(VSExternalInclude lib2) # and the sln file can no longer be the only source # of that depend. So, for VS 10 make the executable # depend on lib1 and lib2 -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") add_dependencies(VSExternalInclude lib1) endif() diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 951f7ab..fd8cda9 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -88,6 +88,11 @@ if(SPHINX_QTHELP) COMMAND ${CMAKE_COMMAND} "-DQTHELP_DIR=${CMAKE_CURRENT_BINARY_DIR}/qthelp/" "-DCMake_VERSION=${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}" -P "${CMAKE_CURRENT_SOURCE_DIR}/fixup_qthelp_names.cmake" + + # Create proper identifiers. Workaround for + # https://bitbucket.org/birkenfeld/sphinx/issue/1491/qthelp-should-generate-identifiers-for + COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/create_identifiers.py" "${CMAKE_CURRENT_BINARY_DIR}/qthelp/" + COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp ) endif() diff --git a/Utilities/Sphinx/create_identifiers.py b/Utilities/Sphinx/create_identifiers.py new file mode 100755 index 0000000..4db7a3f --- /dev/null +++ b/Utilities/Sphinx/create_identifiers.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +import sys, os + +if len(sys.argv) != 2: + sys.exit(-1) +name = sys.argv[1] + "/CMake.qhp" + +f = open(name) + +if not f: + sys.exit(-1) + +lines = f.read().splitlines() + +if not lines: + sys.exit(-1) + +newlines = [] + +for line in lines: + if "<keyword name=\"command\"" in line: + if not "id=\"" in line: + prefix = "<keyword name=\"command\" " + part1, part2 = line.split(prefix) + head, tail = part2.split("#command:") + cmdname, rest = tail.split("\"") + line = part1 + prefix + "id=\"command/" + cmdname + "\" " + part2 + newlines.append(line + "\n") + +f = open(name, "w") +f.writelines(newlines) diff --git a/Utilities/Sphinx/templates/layout.html b/Utilities/Sphinx/templates/layout.html index 635ace3..1c5728c 100644 --- a/Utilities/Sphinx/templates/layout.html +++ b/Utilities/Sphinx/templates/layout.html @@ -11,3 +11,9 @@ <a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>{{ reldelim1 }} </li> {% endblock %} + +{# Put some context in the html title element. Workaround for #} +{# https://bitbucket.org/birkenfeld/sphinx/issue/1492/qthelp-generate-html-title-element-should #} +{% block htmltitle %} + <title>{{ title|striptags|e }} {{ "—"|safe }} {{ docstitle|e }}</title> +{% endblock %} @@ -1477,9 +1477,11 @@ fi # When bootstrapping on MinGW with MSYS we must convert the source # directory to a windows path. if ${cmake_system_mingw}; then - cmake_root_dir=`cd "${cmake_source_dir}"; pwd -W` + CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W` + CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W` else - cmake_root_dir="${cmake_source_dir}" + CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}" + CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}" fi # Write CMake version @@ -1487,7 +1489,8 @@ cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_versi cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}" cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}" cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\"" -cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\"" +cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\"" +cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" |