diff options
75 files changed, 632 insertions, 864 deletions
diff --git a/Help/generator/Visual Studio 8 2005.rst b/Help/generator/Visual Studio 8 2005.rst index 29012c3..acbbf01 100644 --- a/Help/generator/Visual Studio 8 2005.rst +++ b/Help/generator/Visual Studio 8 2005.rst @@ -1,7 +1,14 @@ Visual Studio 8 2005 -------------------- -Generates Visual Studio 8 2005 project files. +Deprecated. Generates Visual Studio 8 2005 project files. + +.. note:: + This generator is deprecated and will be removed in a future version + of CMake. It will still be possible to build with VS 8 2005 tools + using the :generator:`Visual Studio 10 2010` (or above) generator + with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v80``, or by + using the :generator:`NMake Makefiles` generator. The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set to specify a target platform name. diff --git a/Help/generator/Xcode.rst b/Help/generator/Xcode.rst index 25ff4c7..968c26a 100644 --- a/Help/generator/Xcode.rst +++ b/Help/generator/Xcode.rst @@ -3,6 +3,8 @@ Xcode Generate Xcode project files. +This supports Xcode 3.0 and above. + Toolset Selection ^^^^^^^^^^^^^^^^^ diff --git a/Help/release/dev/ninja-loosen-object-deps.rst b/Help/release/dev/ninja-loosen-object-deps.rst new file mode 100644 index 0000000..c47fb93 --- /dev/null +++ b/Help/release/dev/ninja-loosen-object-deps.rst @@ -0,0 +1,8 @@ +ninja-loosen-object-deps +------------------------ + +* The :generator:`Ninja` generator has loosened dependencies on object + compilation to depend on the custom targets and commands of dependent + libraries instead of the libraries themselves. This helps projects with deep + dependency graphs to be blocked only on their link steps at the deeper + levels rather than also blocking object compilation on dependent link steps. diff --git a/Help/release/dev/remove-xcode-2.rst b/Help/release/dev/remove-xcode-2.rst new file mode 100644 index 0000000..5b36582 --- /dev/null +++ b/Help/release/dev/remove-xcode-2.rst @@ -0,0 +1,5 @@ +remove-xcode-2 +-------------- + +* The :generator:`Xcode` generator dropped support for Xcode versions + older than 3. diff --git a/Help/release/dev/vs8-deprecate.rst b/Help/release/dev/vs8-deprecate.rst new file mode 100644 index 0000000..97d996f --- /dev/null +++ b/Help/release/dev/vs8-deprecate.rst @@ -0,0 +1,5 @@ +vs8-deprecate +------------- + +* The :generator:`Visual Studio 8 2005` generator is now deprecated + and will be removed in a future version of CMake. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 687263a..eeb806f 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -324,18 +324,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} else() set(id_sdkroot "") endif() - if(NOT ${XCODE_VERSION} VERSION_LESS 3) - set(v 3) - set(ext xcodeproj) - elseif(NOT ${XCODE_VERSION} VERSION_LESS 2) - set(v 2) - set(ext xcodeproj) - else() - set(v 1) - set(ext xcode) - endif() - configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-${v}.pbxproj.in - ${id_dir}/CompilerId${lang}.${ext}/project.pbxproj @ONLY) + configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in + ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY) unset(_ENV_MACOSX_DEPLOYMENT_TARGET) if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET}) set(_ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}") diff --git a/Modules/CompilerId/Xcode-1.pbxproj.in b/Modules/CompilerId/Xcode-1.pbxproj.in deleted file mode 100644 index 793ad02..0000000 --- a/Modules/CompilerId/Xcode-1.pbxproj.in +++ /dev/null @@ -1,120 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 39; - objects = { - 014CEA460018CE2711CA2923 = { - buildSettings = { - }; - isa = PBXBuildStyle; - name = Development; - }; - 08FB7793FE84155DC02AAC07 = { - buildSettings = { - }; - buildStyles = ( - 014CEA460018CE2711CA2923, - ); - hasScannedForEncodings = 1; - isa = PBXProject; - mainGroup = 08FB7794FE84155DC02AAC07; - projectDirPath = ""; - targets = ( - 8DD76FA90486AB0100D96B5E, - ); - }; - 08FB7794FE84155DC02AAC07 = { - children = ( - 08FB7795FE84155DC02AAC07, - 1AB674ADFE9D54B511CA2CBB, - ); - isa = PBXGroup; - name = CompilerId@id_lang@; - refType = 4; - sourceTree = "<group>"; - }; - 08FB7795FE84155DC02AAC07 = { - children = ( - 2C18F0B415DC1DC700593670, - ); - isa = PBXGroup; - name = Source; - refType = 4; - sourceTree = "<group>"; - }; - 1AB674ADFE9D54B511CA2CBB = { - children = ( - 8DD76F6C0486A84900D96B5E, - ); - isa = PBXGroup; - name = Products; - refType = 4; - sourceTree = "<group>"; - }; - 2C18F0B415DC1DC700593670 = { - fileEncoding = 30; - isa = PBXFileReference; - explicitFileType = @id_type@; - path = @id_src@; - refType = 4; - sourceTree = "<group>"; - }; - 2C18F0B615DC1E0300593670 = { - fileRef = 2C18F0B415DC1DC700593670; - isa = PBXBuildFile; - settings = { - }; - }; - 2C8FEB8E15DC1A1A00E56A5D = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; - }; - 8DD76FA90486AB0100D96B5E = { - buildPhases = ( - 2C18F0B515DC1DCE00593670, - 2C8FEB8E15DC1A1A00E56A5D, - ); - buildRules = ( - ); - buildSettings = { - PRODUCT_NAME = CompilerId@id_lang@; - SYMROOT = .; - }; - dependencies = ( - ); - isa = PBXNativeTarget; - name = CompilerId@id_lang@; - productName = CompilerId@id_lang@; - productReference = 8DD76F6C0486A84900D96B5E; - productType = "com.apple.product-type.tool"; - }; - 2C18F0B515DC1DCE00593670 = { - buildActionMask = 2147483647; - files = ( - 2C18F0B615DC1E0300593670, - ); - isa = PBXSourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8DD76F6C0486A84900D96B5E = { - explicitFileType = "compiled.mach-o.executable"; - includeInIndex = 0; - isa = PBXFileReference; - path = CompilerId@id_lang@; - refType = 3; - sourceTree = BUILT_PRODUCTS_DIR; - }; - }; - rootObject = 08FB7793FE84155DC02AAC07; -} diff --git a/Modules/CompilerId/Xcode-2.pbxproj.in b/Modules/CompilerId/Xcode-2.pbxproj.in deleted file mode 100644 index 226b413..0000000 --- a/Modules/CompilerId/Xcode-2.pbxproj.in +++ /dev/null @@ -1,119 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - - 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; - 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; explicitFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; }; - 8DD76F6C0486A84900D96B5E = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CompilerId@id_lang@; sourceTree = BUILT_PRODUCTS_DIR; }; - - 08FB7794FE84155DC02AAC07 = { - isa = PBXGroup; - children = ( - 08FB7795FE84155DC02AAC07, - 1AB674ADFE9D54B511CA2CBB, - ); - name = CompilerId@id_lang@; - sourceTree = "<group>"; - }; - 08FB7795FE84155DC02AAC07 = { - isa = PBXGroup; - children = ( - 2C18F0B415DC1DC700593670, - ); - name = Source; - sourceTree = "<group>"; - }; - 1AB674ADFE9D54B511CA2CBB = { - isa = PBXGroup; - children = ( - 8DD76F6C0486A84900D96B5E, - ); - name = Products; - sourceTree = "<group>"; - }; - - 8DD76FA90486AB0100D96B5E = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB928508733DD80010E9CD; - buildPhases = ( - 2C18F0B515DC1DCE00593670, - 2C8FEB8E15DC1A1A00E56A5D, - ); - buildRules = ( - ); - dependencies = ( - ); - name = CompilerId@id_lang@; - productName = CompilerId@id_lang@; - productReference = 8DD76F6C0486A84900D96B5E; - productType = "com.apple.product-type.tool"; - }; - 08FB7793FE84155DC02AAC07 = { - isa = PBXProject; - buildConfigurationList = 1DEB928908733DD80010E9CD; - hasScannedForEncodings = 1; - mainGroup = 08FB7794FE84155DC02AAC07; - projectDirPath = ""; - targets = ( - 8DD76FA90486AB0100D96B5E, - ); - }; - 2C8FEB8E15DC1A1A00E56A5D = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; - }; - 2C18F0B515DC1DCE00593670 = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2C18F0B615DC1E0300593670, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1DEB928608733DD80010E9CD = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = CompilerId@id_lang@; - }; - name = Debug; - }; - 1DEB928A08733DD80010E9CD = { - isa = XCBuildConfiguration; - buildSettings = { - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; - SYMROOT = .; - }; - name = Debug; - }; - 1DEB928508733DD80010E9CD = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB928608733DD80010E9CD, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 1DEB928908733DD80010E9CD = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB928A08733DD80010E9CD, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - }; - rootObject = 08FB7793FE84155DC02AAC07; -} diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 3e8be5b..fab53cb 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -10,77 +10,78 @@ # The Message Passing Interface (MPI) is a library used to write # high-performance distributed-memory parallel applications, and is # typically deployed on a cluster. MPI is a standard interface (defined -# by the MPI forum) for which many implementations are available. All -# of them have somewhat different include paths, libraries to link -# against, etc., and this module tries to smooth out those differences. +# by the MPI forum) for which many implementations are available. # # Variables # ^^^^^^^^^ # # This module will set the following variables per language in your -# project, where <lang> is one of C, CXX, or Fortran: -# -# :: -# -# MPI_<lang>_FOUND TRUE if FindMPI found MPI flags for <lang> -# MPI_<lang>_COMPILER MPI Compiler wrapper for <lang> -# MPI_<lang>_COMPILE_FLAGS Compilation flags for MPI programs -# MPI_<lang>_INCLUDE_PATH Include path(s) for MPI header -# MPI_<lang>_LINK_FLAGS Linking flags for MPI programs -# MPI_<lang>_LIBRARIES All libraries to link MPI programs against +# project, where ``<lang>`` is one of C, CXX, or Fortran: +# +# ``MPI_<lang>_FOUND`` +# Variable indicating the MPI settings for ``<lang>`` were found. +# ``MPI_<lang>_COMPILER`` +# MPI Compiler wrapper for ``<lang>``. +# ``MPI_<lang>_COMPILE_FLAGS`` +# Compilation flags for MPI programs, separated by spaces. +# This is *not* a :ref:`;-list <CMake Language Lists>`. +# ``MPI_<lang>_INCLUDE_PATH`` +# Include path(s) for MPI header. +# ``MPI_<lang>_LINK_FLAGS`` +# Linker flags for MPI programs. +# ``MPI_<lang>_LIBRARIES`` +# All libraries to link MPI programs against. # # Additionally, the following :prop_tgt:`IMPORTED` targets are defined: # -# :: -# -# MPI::MPI_<lang> Target for using MPI from <lang> +# ``MPI::MPI_<lang>`` +# Target for using MPI from ``<lang>``. # # Additionally, FindMPI sets the following variables for running MPI # programs from the command line: # -# :: -# -# MPIEXEC Executable for running MPI programs -# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving -# it the number of processors to run on -# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly -# before the executable to run. -# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after other flags +# ``MPIEXEC`` +# Executable for running MPI programs, if provided. +# ``MPIEXEC_NUMPROC_FLAG`` +# Flag to pass to ``MPIEXEC`` before giving it the number of processors to run on. +# ``MPIEXEC_MAX_NUMPROCS`` +# Number of MPI processors to utilize. Defaults to the number +# of processors detected on the host system. +# ``MPIEXEC_PREFLAGS`` +# Flags to pass to ``MPIEXEC`` directly before the executable to run. +# ``MPIEXEC_POSTFLAGS`` +# Flags to pass to ``MPIEXEC`` after other flags. # # Usage # ^^^^^ # -# To use this module, simply call FindMPI from a CMakeLists.txt file, or -# run ``find_package(MPI)``, then run CMake. If you are happy with the +# To use this module, call ``find_package(MPI)``. If you are happy with the # auto-detected configuration for your language, then you're done. If # not, you have two options: # -# :: -# -# 1. Set MPI_<lang>_COMPILER to the MPI wrapper (mpicc, etc.) of your -# choice and reconfigure. FindMPI will attempt to determine all the -# necessary variables using THAT compiler's compile and link flags. -# 2. If this fails, or if your MPI implementation does not come with -# a compiler wrapper, then set both MPI_<lang>_LIBRARIES and -# MPI_<lang>_INCLUDE_PATH. You may also set any other variables -# listed above, but these two are required. This will circumvent -# autodetection entirely. +# 1. Set ``MPI_<lang>_COMPILER`` to the MPI wrapper (e.g. ``mpicc``) of your +# choice and reconfigure. FindMPI will attempt to determine all the +# necessary variables using *that* compiler's compile and link flags. +# 2. If this fails, or if your MPI implementation does not come with +# a compiler wrapper, then set both ``MPI_<lang>_LIBRARIES`` and +# ``MPI_<lang>_INCLUDE_PATH``. You may also set any other variables +# listed above, but these two are required. This will circumvent +# autodetection entirely. # # When configuration is successful, ``MPI_<lang>_COMPILER`` will be set to -# the compiler wrapper for <lang>, if it was found. ``MPI_<lang>_FOUND`` +# the compiler wrapper for ``<lang>``, if it was found. ``MPI_<lang>_FOUND`` # and other variables above will be set if any MPI implementation was -# found for <lang>, regardless of whether a compiler was found. +# found for ``<lang>``, regardless of whether a compiler was found. # # When using ``MPIEXEC`` to execute MPI applications, you should typically # use all of the ``MPIEXEC`` flags as follows: # # :: # -# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS +# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} # ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS # -# where ``PROCS`` is the number of processors on which to execute the -# program, ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to +# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to # pass to the MPI program. # # Backward Compatibility @@ -106,12 +107,12 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) # The compilers are detected in this order: # # 1. Try to find the most generic available MPI compiler, as this is usually set up by -# cluster admins. e.g., if plain old mpicc is available, we'll use it and assume it's +# cluster admins, e.g. if plain old mpicc is available, we'll use it and assume it's # the right compiler. # # 2. If a generic mpicc is NOT found, then we attempt to find one that matches # CMAKE_<lang>_COMPILER_ID. e.g. if you are using XL compilers, we'll try to find mpixlc -# and company, but not mpiicc. This hopefully prevents toolchain mismatches. +# and company, but not mpiicc. This hopefully prevents toolchain mismatches. # # If you want to force a particular MPI compiler other than what we autodetect (e.g. if you # want to compile regular stuff with GNU and parallel stuff with Intel), you can always set @@ -482,7 +483,7 @@ function (interrogate_mpi_compiler lang try_libs) set(MPI_${lang}_LIBRARIES ${MPI_LIBRARIES_WORK} CACHE STRING "MPI ${lang} libraries to link against" FORCE) mark_as_advanced(MPI_${lang}_COMPILE_FLAGS MPI_${lang}_INCLUDE_PATH MPI_${lang}_LINK_FLAGS MPI_${lang}_LIBRARIES) - # clear out our temporary lib/header detectionv variable here. + # clear out our temporary lib/header detection variable here. set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI lib detection" FORCE) set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI header detection" FORCE) endif() @@ -552,10 +553,21 @@ find_program(MPIEXEC get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH) get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.") +# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to +# launch an MPI process using mpiexec if such a program exists. +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.") set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.") set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.") -set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.") + +# Set the number of processes to the processor count and the previous default +# of 2 if that couldn't be determined. +include(${CMAKE_CURRENT_LIST_DIR}/ProcessorCount.cmake) +ProcessorCount(_MPIEXEC_NUMPROCS) +if("${_MPIEXEC_NUMPROCS}" EQUAL "0") + set(_MPIEXEC_NUMPROCS 2) +endif() +set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.") +unset(_MPIEXEC_NUMPROCS) mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 93255ae..8ae3720 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -244,21 +244,23 @@ # # :: # -# install_jar_exports(TARGETS jar1 [jar2 ...] -# FILE export_filename -# DESTINATION destination [COMPONENT component]) +# install_jar_exports(TARGETS jars... +# [NAMESPACE <namespace>] +# FILE <filename> +# DESTINATION <dir> [COMPONENT <component>]) # -# This command installs a target export file export_filename for the named jar -# targets to the given DESTINATION. Its function is similar to that of -# install(EXPORTS). +# This command installs a target export file ``<filename>`` for the named jar +# targets to the given ``DESTINATION``. Its function is similar to that of +# :command:`install(EXPORTS ...)`. # # :: # -# export_jars(TARGETS jar1 [jar2 ...] -# FILE export_filename) +# export_jars(TARGETS jars... +# [NAMESPACE <namespace>] +# FILE <filename>) # -# This command writes a target export file export_filename for the named jar -# targets. Its function is similar to that of export(). +# This command writes a target export file ``<filename>`` for the named jar +# targets. Its function is similar to that of :command:`export(...)`. # # :: # @@ -424,10 +426,12 @@ endfunction() function(__java_export_jar VAR TARGET PATH) get_target_property(_jarpath ${TARGET} JAR_FILE) get_filename_component(_jarname ${_jarpath} NAME) + set(_target "${_jar_NAMESPACE}${TARGET}") __java_lcat(${VAR} - "# Create imported target ${TARGET}" - "add_custom_target(${TARGET})" - "set_target_properties(${TARGET} PROPERTIES" + "# Create imported target ${_target}" + "add_library(${_target} IMPORTED STATIC)" + "set_target_properties(${_target} PROPERTIES" + " IMPORTED_LOCATION \"${PATH}/${_jarname}\"" " JAR_FILE \"${PATH}/${_jarname}\")" "" ) @@ -1341,7 +1345,7 @@ function(export_jars) # Parse and validate arguments cmake_parse_arguments(_export_jars "" - "FILE" + "FILE;NAMESPACE" "TARGETS" ${ARGN} ) @@ -1351,6 +1355,7 @@ function(export_jars) if (NOT _export_jars_TARGETS) message(SEND_ERROR "export_jars: TARGETS must be specified.") endif() + set(_jar_NAMESPACE "${_export_jars_NAMESPACE}") # Set content of generated exports file string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}") @@ -1373,7 +1378,7 @@ function(install_jar_exports) # Parse and validate arguments cmake_parse_arguments(_install_jar_exports "" - "FILE;DESTINATION;COMPONENT" + "FILE;DESTINATION;COMPONENT;NAMESPACE" "TARGETS" ${ARGN} ) @@ -1386,6 +1391,7 @@ function(install_jar_exports) if (NOT _install_jar_exports_TARGETS) message(SEND_ERROR "install_jar_exports: TARGETS must be specified.") endif() + set(_jar_NAMESPACE "${_install_jar_exports_NAMESPACE}") if (_install_jar_exports_COMPONENT) set (_COMPONENT COMPONENT ${_install_jar_exports_COMPONENT}) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ea6e0e2..fcb0b8b 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 8) -set(CMake_VERSION_PATCH 20170421) +set(CMake_VERSION_PATCH 20170424) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 3aebbc8..57b47f1 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -288,7 +288,7 @@ public: hasFiles = false; hasErrors = false; - basePath = cmSystemTools::GetFilenamePath(installer->Resources[r].data()); + basePath = cmSystemTools::GetFilenamePath(installer->Resources[r]); ParseFile(installer->Resources[r].data()); @@ -360,8 +360,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() cmSystemTools::GetFilenameName(InstallerApplicationIcon); std::string path = Directory + "/config/" + name; name = cmSystemTools::GetFilenameWithoutExtension(name); - cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon.data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon, path); xout.Element("InstallerApplicationIcon", name); } @@ -369,8 +368,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!InstallerWindowIcon.empty()) { std::string name = cmSystemTools::GetFilenameName(InstallerWindowIcon); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon.data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon, path); xout.Element("InstallerWindowIcon", name); } @@ -378,7 +376,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Logo.empty()) { std::string name = cmSystemTools::GetFilenameName(Logo); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Logo.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Logo, path); xout.Element("Logo", name); } @@ -386,7 +384,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Banner.empty()) { std::string name = cmSystemTools::GetFilenameName(Banner); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Banner.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Banner, path); xout.Element("Banner", name); } @@ -394,7 +392,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Watermark.empty()) { std::string name = cmSystemTools::GetFilenameName(Watermark); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Watermark.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Watermark, path); xout.Element("Watermark", name); } @@ -402,7 +400,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Background.empty()) { std::string name = cmSystemTools::GetFilenameName(Background); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Background.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Background, path); xout.Element("Background", name); } @@ -480,7 +478,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!IsVersionLess("2.0") && !ControlScript.empty()) { std::string name = cmSystemTools::GetFilenameName(ControlScript); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(ControlScript, path); xout.Element("ControlScript", name); } @@ -492,8 +490,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (parser.ParseResource(i)) { std::string name = cmSystemTools::GetFilenameName(Resources[i]); std::string path = Directory + "/resources/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Resources[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Resources[i], path); resources.push_back(name); } else { cmCPackLogger(cmCPackLog::LOG_WARNING, "Can't copy resources from \"" diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 2a95ba8..99e8b9e 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -590,7 +590,7 @@ void cmCPackIFWPackage::GeneratePackageFile() if (!Script.empty()) { std::string name = cmSystemTools::GetFilenameName(Script); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Script.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Script, path); xout.Element("Script", name); } @@ -599,8 +599,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 0; i < userInterfaces.size(); i++) { std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i], path); userInterfaces[i] = name; } if (!userInterfaces.empty()) { @@ -616,8 +615,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 0; i < translations.size(); i++) { std::string name = cmSystemTools::GetFilenameName(translations[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(translations[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(translations[i], path); translations[i] = name; } if (!translations.empty()) { @@ -675,7 +673,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 1; i < licenses.size(); i += 2) { std::string name = cmSystemTools::GetFilenameName(licenses[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(licenses[i].data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(licenses[i], path); licenses[i] = name; } if (!licenses.empty()) { diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 4d970d5..87c532c 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -2222,7 +2222,8 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir) if (line.empty() || line[0] == '#') { // Ignore blank and comment lines. continue; - } else if (line[0] == ' ') { + } + if (line[0] == ' ') { // Label lines appear indented by one space. std::string label = line.substr(1); int id = this->GetLabelId(label); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 7195bb3..a782150 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -306,7 +306,8 @@ void cmCTestLaunch::LoadLabels() if (line.empty() || line[0] == '#') { // Ignore blank and comment lines. continue; - } else if (line[0] == ' ') { + } + if (line[0] == ' ') { // Label lines appear indented by one space. if (inTarget || inSource) { this->Labels.insert(line.c_str() + 1); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index d738a1b..fdc16b1 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -561,7 +561,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() // In parallel test runs repeatedly move dependencies of the tests on // the current dependency level to the next level until no // further dependencies exist. - while (priorityStack.back().size()) { + while (!priorityStack.back().empty()) { TestSet& previousSet = priorityStack.back(); priorityStack.push_back(TestSet()); TestSet& currentSet = priorityStack.back(); diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index a756188..21b1003 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -33,10 +33,11 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() const char* ctestTimeout = this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT"); - double timeout = this->CTest->GetTimeOut(); + double timeout; if (ctestTimeout) { timeout = atof(ctestTimeout); } else { + timeout = this->CTest->GetTimeOut(); if (timeout <= 0) { // By default use timeout of 10 minutes timeout = 600; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index dafeec2..167fecf 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1633,10 +1633,10 @@ void cmCTestTestHandler::UseExcludeRegExp() const char* cmCTestTestHandler::GetTestStatus(int status) { - static const char statuses[][100] = { - "Not Run", "Timeout", "SEGFAULT", "ILLEGAL", "INTERRUPT", - "NUMERICAL", "OTHER_FAULT", "Failed", "BAD_COMMAND", "Completed" - }; + static const char* statuses[] = { "Not Run", "Timeout", "SEGFAULT", + "ILLEGAL", "INTERRUPT", "NUMERICAL", + "OTHER_FAULT", "Failed", "BAD_COMMAND", + "Completed" }; if (status < cmCTestTestHandler::NOT_RUN || status > cmCTestTestHandler::COMPLETED) { diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index 9ae48d8..9cdd50b 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -46,7 +46,8 @@ public: beginSet.push_back("begin"); coverageVector.push_back(-1); continue; - } else if (line.find('{') != line.npos) { + } + if (line.find('{') != line.npos) { blockComFlag = true; } else if (line.find('}') != line.npos) { blockComFlag = false; diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index d299547..7fb065d 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -159,7 +159,8 @@ void cmCursesLongMessageForm::HandleInput() // quit if (key == 'o' || key == 'e') { break; - } else if (key == KEY_DOWN || key == ctrl('n')) { + } + if (key == KEY_DOWN || key == ctrl('n')) { form_driver(this->Form, REQ_SCR_FLINE); } else if (key == KEY_UP || key == ctrl('p')) { form_driver(this->Form, REQ_SCR_BLINE); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 939c736..ca824c0 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -764,9 +764,8 @@ void cmCursesMainForm::HandleInput() // quit if (key == 'q') { break; - } else { - continue; } + continue; } currentField = current_field(this->Form); @@ -826,7 +825,7 @@ void cmCursesMainForm::HandleInput() // (index always corresponds to the value field) // scroll down with arrow down, ctrl+n (emacs binding), or j (vim // binding) - else if (key == KEY_DOWN || key == ctrl('n') || key == 'j') { + if (key == KEY_DOWN || key == ctrl('n') || key == 'j') { FIELD* cur = current_field(this->Form); size_t findex = field_index(cur); if (findex == 3 * this->NumberOfVisibleEntries - 1) { diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 34ec0e3..dbd4dd1 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -32,7 +32,8 @@ bool cmAddSubDirectoryCommand::InitialPass( if (*i == "EXCLUDE_FROM_ALL") { excludeFromAll = true; continue; - } else if (binArg.empty()) { + } + if (binArg.empty()) { binArg = *i; } else { this->SetError("called with incorrect number of arguments"); diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 70581ad..4adfe23 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -360,7 +360,8 @@ std::string cmWrap(std::string const& prefix, Range const& r, } template <typename Range> -std::string cmWrap(char prefix, Range const& r, char suffix, std::string sep) +std::string cmWrap(char prefix, Range const& r, char suffix, + std::string const& sep) { return cmWrap(std::string(1, prefix), r, std::string(1, suffix), sep); } diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h index c4065e1..1e7c42a 100644 --- a/Source/cmCLocaleEnvironmentScope.h +++ b/Source/cmCLocaleEnvironmentScope.h @@ -15,6 +15,9 @@ public: ~cmCLocaleEnvironmentScope(); private: + cmCLocaleEnvironmentScope(cmCLocaleEnvironmentScope const&); + cmCLocaleEnvironmentScope& operator=(cmCLocaleEnvironmentScope const&); + std::string GetEnv(std::string const& key); void SetEnv(std::string const& key, std::string const& value); diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index 2b65a5a..c0c1cd9 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -60,6 +60,10 @@ public: char BSLASHVariable[3]; private: + cmCommandArgumentParserHelper(cmCommandArgumentParserHelper const&); + cmCommandArgumentParserHelper& operator=( + cmCommandArgumentParserHelper const&); + std::string::size_type InputBufferPos; std::string InputBuffer; std::vector<char> OutputBuffer; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 034a266..fa166a0 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -613,8 +613,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) continue; } - else if ((c >= 0x20 && c < 0x7F) || c == '\t' || - (c == '\n' && newline_consume)) { + if ((c >= 0x20 && c < 0x7F) || c == '\t' || + (c == '\n' && newline_consume)) { // This is an ASCII character that may be part of a string. // Cast added to avoid compiler warning. Cast is ok because // c is guaranteed to fit in char by the above if... diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index 9e66035..ed794c3 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -236,7 +236,7 @@ public: cmFileMonitor::Callback cb) : Parent(p) , PathSegment(ps) - , CbList({ cb }) + , CbList({ std::move(cb) }) { assert(p); assert(!ps.empty()); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 10a7706..a0f677b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3973,15 +3973,14 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, << theTarget->GetName() << "\".\n"; cmSystemTools::Error(e.str().c_str()); break; - } else { - propContent = consistent.second; - continue; } - } else { - // Explicitly set on target and not set in iface. Can't disagree. + propContent = consistent.second; continue; } - } else if (impliedByUse) { + // Explicitly set on target and not set in iface. Can't disagree. + continue; + } + if (impliedByUse) { propContent = impliedValue<PropertyType>(propContent); if (ifaceIsSet) { @@ -3999,43 +3998,36 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, << "\" is in conflict.\n"; cmSystemTools::Error(e.str().c_str()); break; - } else { - propContent = consistent.second; - continue; } - } else { - // Implicitly set on target and not set in iface. Can't disagree. + propContent = consistent.second; continue; } - } else { - if (ifaceIsSet) { - if (propInitialized) { - std::pair<bool, PropertyType> consistent = - consistentProperty(propContent, ifacePropContent, t); - report += reportEntry; - report += compatibilityAgree(t, propContent != consistent.second); - if (!consistent.first) { - std::ostringstream e; - e << "The INTERFACE_" << p << " property of \"" - << theTarget->GetName() << "\" does\nnot agree with the value " - "of " - << p << " already determined\nfor \"" << tgt->GetName() - << "\".\n"; - cmSystemTools::Error(e.str().c_str()); - break; - } else { - propContent = consistent.second; - continue; - } - } else { - report += reportEntry + "(Interface set)\n"; - propContent = ifacePropContent; - propInitialized = true; + // Implicitly set on target and not set in iface. Can't disagree. + continue; + } + if (ifaceIsSet) { + if (propInitialized) { + std::pair<bool, PropertyType> consistent = + consistentProperty(propContent, ifacePropContent, t); + report += reportEntry; + report += compatibilityAgree(t, propContent != consistent.second); + if (!consistent.first) { + std::ostringstream e; + e << "The INTERFACE_" << p << " property of \"" + << theTarget->GetName() << "\" does\nnot agree with the value of " + << p << " already determined\nfor \"" << tgt->GetName() << "\".\n"; + cmSystemTools::Error(e.str().c_str()); + break; } - } else { - // Not set. Nothing to agree on. + propContent = consistent.second; continue; } + report += reportEntry + "(Interface set)\n"; + propContent = ifacePropContent; + propInitialized = true; + } else { + // Not set. Nothing to agree on. + continue; } } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e61cbd9..1a77d7c 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -966,8 +966,14 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies() } } +std::string OrderDependsTargetForTarget(cmGeneratorTarget const* target) +{ + return "cmake_object_order_depends_target_" + target->GetName(); +} + void cmGlobalNinjaGenerator::AppendTargetOutputs( - cmGeneratorTarget const* target, cmNinjaDeps& outputs) + cmGeneratorTarget const* target, cmNinjaDeps& outputs, + cmNinjaTargetDepends depends) { std::string configName = target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); @@ -979,15 +985,27 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( bool realname = target->IsFrameworkOnApple(); switch (target->GetType()) { - case cmStateEnums::EXECUTABLE: case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::STATIC_LIBRARY: case cmStateEnums::MODULE_LIBRARY: { + if (depends == DependOnTargetOrdering) { + outputs.push_back(OrderDependsTargetForTarget(target)); + break; + } + } + // FALLTHROUGH + case cmStateEnums::EXECUTABLE: { outputs.push_back(this->ConvertToNinjaPath(target->GetFullPath( configName, cmStateEnums::RuntimeBinaryArtifact, realname))); break; } - case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: { + if (depends == DependOnTargetOrdering) { + outputs.push_back(OrderDependsTargetForTarget(target)); + break; + } + } + // FALLTHROUGH case cmStateEnums::GLOBAL_TARGET: case cmStateEnums::UTILITY: { std::string path = @@ -1003,7 +1021,8 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( } void cmGlobalNinjaGenerator::AppendTargetDepends( - cmGeneratorTarget const* target, cmNinjaDeps& outputs) + cmGeneratorTarget const* target, cmNinjaDeps& outputs, + cmNinjaTargetDepends depends) { if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { // These depend only on other CMake-provided targets, e.g. "all". @@ -1023,7 +1042,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - this->AppendTargetOutputs(*i, outs); + this->AppendTargetOutputs(*i, outs, depends); } std::sort(outs.begin(), outs.end()); outputs.insert(outputs.end(), outs.begin(), outs.end()); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index e06afb0..b1d6155 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -316,10 +316,12 @@ public: ASD.insert(deps.begin(), deps.end()); } - void AppendTargetOutputs(cmGeneratorTarget const* target, - cmNinjaDeps& outputs); - void AppendTargetDepends(cmGeneratorTarget const* target, - cmNinjaDeps& outputs); + void AppendTargetOutputs( + cmGeneratorTarget const* target, cmNinjaDeps& outputs, + cmNinjaTargetDepends depends = DependOnTargetArtifact); + void AppendTargetDepends( + cmGeneratorTarget const* target, cmNinjaDeps& outputs, + cmNinjaTargetDepends depends = DependOnTargetArtifact); void AppendTargetDependsClosure(cmGeneratorTarget const* target, cmNinjaDeps& outputs); void AddDependencyToAll(cmGeneratorTarget* target); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 14ec72f..1b75a08 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -293,6 +293,19 @@ void cmGlobalVisualStudio7Generator::Generate() if (!cmSystemTools::GetErrorOccuredFlag()) { this->CallVisualStudioMacro(MacroReload); } + + if (this->Version == VS8 && !this->CMakeInstance->GetIsInTryCompile()) { + const char* cmakeWarnVS8 = + this->CMakeInstance->GetState()->GetCacheEntryValue("CMAKE_WARN_VS8"); + if (!cmakeWarnVS8 || !cmSystemTools::IsOff(cmakeWarnVS8)) { + this->CMakeInstance->IssueMessage( + cmake::WARNING, + "The \"Visual Studio 8 2005\" generator is deprecated " + "and will be removed in a future version of CMake." + "\n" + "Add CMAKE_WARN_VS8=OFF to the cache to disable this warning."); + } + } } void cmGlobalVisualStudio7Generator::OutputSLNFile( diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 1fcb5ac..7a42b72 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -54,7 +54,7 @@ public: void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE { entry.Name = std::string(vs8generatorName) + " [arch]"; - entry.Brief = "Generates Visual Studio 2005 project files. " + entry.Brief = "Deprecated. Generates Visual Studio 2005 project files. " "Optional [arch] can be \"Win64\"."; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4213751..6636329 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -133,16 +133,12 @@ public: bool SupportsPlatform() const CM_OVERRIDE { return false; } }; -cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm, - std::string const& version) +cmGlobalXCodeGenerator::cmGlobalXCodeGenerator( + cmake* cm, std::string const& version_string, unsigned int version_number) : cmGlobalGenerator(cm) { - this->VersionString = version; - - // Compute an integer form of the version number. - unsigned int v[2] = { 0, 0 }; - sscanf(this->VersionString.c_str(), "%u.%u", &v[0], &v[1]); - this->XcodeVersion = 10 * v[0] + v[1]; + this->VersionString = version_string; + this->XcodeVersion = version_number; this->RootObject = 0; this->MainGroupChildren = 0; @@ -189,13 +185,21 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator( parser.ParseFile( "/Developer/Applications/Xcode.app/Contents/version.plist"); } - CM_AUTO_PTR<cmGlobalXCodeGenerator> gg( - new cmGlobalXCodeGenerator(cm, parser.Version)); - if (gg->XcodeVersion == 20) { - cmSystemTools::Message("Xcode 2.0 not really supported by cmake, " - "using Xcode 15 generator\n"); - gg->XcodeVersion = 15; + std::string const& version_string = parser.Version; + + // Compute an integer form of the version number. + unsigned int v[2] = { 0, 0 }; + sscanf(version_string.c_str(), "%u.%u", &v[0], &v[1]); + unsigned int version_number = 10 * v[0] + v[1]; + + if (version_number < 30) { + cm->IssueMessage(cmake::FATAL_ERROR, + "Xcode " + version_string + " not supported."); + return CM_NULLPTR; } + + CM_AUTO_PTR<cmGlobalXCodeGenerator> gg( + new cmGlobalXCodeGenerator(cm, version_string, version_number)); return gg.release(); #else std::cerr << "CMake should be built with cmake to use Xcode, " @@ -242,29 +246,25 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand() bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, cmMakefile* mf) { - if (this->XcodeVersion >= 30) { - if (ts.find_first_of(",=") != ts.npos) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "does not recognize the toolset\n" - " " << ts << "\n" - "that was specified."; - /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; - } - this->GeneratorToolset = ts; - if (!this->GeneratorToolset.empty()) { - mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", - this->GeneratorToolset.c_str()); - } - return true; - } else { - return cmGlobalGenerator::SetGeneratorToolset(ts, mf); + if (ts.find_first_of(",=") != ts.npos) { + std::ostringstream e; + /* clang-format off */ + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not recognize the toolset\n" + " " << ts << "\n" + "that was specified."; + /* clang-format on */ + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + this->GeneratorToolset = ts; + if (!this->GeneratorToolset.empty()) { + mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", + this->GeneratorToolset.c_str()); } + return true; } void cmGlobalXCodeGenerator::EnableLanguage( @@ -272,16 +272,13 @@ void cmGlobalXCodeGenerator::EnableLanguage( { mf->AddDefinition("XCODE", "1"); mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str()); - if (this->XcodeVersion == 15) { - } else { - if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { - mf->AddCacheDefinition( - "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo", - "Semicolon separated list of supported configuration types, " - "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " - "anything else will be ignored.", - cmStateEnums::STRING); - } + if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { + mf->AddCacheDefinition( + "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo", + "Semicolon separated list of supported configuration types, " + "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " + "anything else will be ignored.", + cmStateEnums::STRING); } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); @@ -301,9 +298,7 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( makeCommand.push_back("-project"); std::string projectArg = projectName; projectArg += ".xcode"; - if (this->XcodeVersion > 20) { - projectArg += "proj"; - } + projectArg += "proj"; makeCommand.push_back(projectArg); bool clean = false; @@ -323,13 +318,8 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( } else { makeCommand.push_back("ALL_BUILD"); } - if (this->XcodeVersion == 15) { - makeCommand.push_back("-buildstyle"); - makeCommand.push_back("Development"); - } else { - makeCommand.push_back("-configuration"); - makeCommand.push_back(!config.empty() ? config : "Debug"); - } + makeCommand.push_back("-configuration"); + makeCommand.push_back(!config.empty() ? config : "Debug"); makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); } @@ -391,9 +381,7 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget( std::string target = tName; std::replace(target.begin(), target.end(), ' ', '_'); std::string out = "PostBuild." + target; - if (this->XcodeVersion > 20) { - out += "." + configName; - } + out += "." + configName; return out; } @@ -603,12 +591,7 @@ void cmGlobalXCodeGenerator::addObject(cmXCodeObject* obj) cmXCodeObject* cmGlobalXCodeGenerator::CreateObject( cmXCodeObject::PBXType ptype) { - cmXCodeObject* obj; - if (this->XcodeVersion == 15) { - obj = new cmXCodeObject(ptype, cmXCodeObject::OBJECT); - } else { - obj = new cmXCode21Object(ptype, cmXCodeObject::OBJECT); - } + cmXCodeObject* obj = new cmXCode21Object(ptype, cmXCodeObject::OBJECT); this->addObject(obj); return obj; } @@ -894,9 +877,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( fileRef->AddAttribute("name", this->CreateString(name)); fileRef->AddAttribute("path", this->CreateString(path)); fileRef->AddAttribute("sourceTree", this->CreateString(sourceTree)); - if (this->XcodeVersion == 15) { - fileRef->AddAttribute("refType", this->CreateString("4")); - } return fileRef; } @@ -1561,9 +1541,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( std::vector<cmCustomCommand> const& commands, const std::string& configName) { std::string makefileName = makefileBasename; - if (this->XcodeVersion > 20) { - makefileName += configName; - } + makefileName += configName; cmGeneratedFileStream makefileStream(makefileName.c_str()); if (!makefileStream) { return; @@ -1712,11 +1690,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, defFlags, this->CurrentMakefile->GetDefineFlags()); // Add preprocessor definitions for this target and configuration. - BuildObjectListOrString ppDefs(this, this->XcodeVersion >= 30); - if (this->XcodeVersion > 15) { - this->AppendDefines( - ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\""); - } + BuildObjectListOrString ppDefs(this, true); + this->AppendDefines( + ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\""); if (const char* exportMacro = gtgt->GetExportMacro()) { // Add the export symbol definition for shared library objects. this->AppendDefines(ppDefs, exportMacro); @@ -1816,16 +1792,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, gtgt->GetType() == cmStateEnums::SHARED_LIBRARY || gtgt->GetType() == cmStateEnums::MODULE_LIBRARY || gtgt->GetType() == cmStateEnums::EXECUTABLE) { - if (this->XcodeVersion >= 21) { - if (!gtgt->UsesDefaultOutputDir(configName, - cmStateEnums::RuntimeBinaryArtifact)) { - std::string pncdir = gtgt->GetDirectory(configName); - buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", - this->CreateString(pncdir)); - } - } else { - buildSettings->AddAttribute("OBJROOT", this->CreateString(pndir)); - pndir = gtgt->GetDirectory(configName); + if (!gtgt->UsesDefaultOutputDir(configName, + cmStateEnums::RuntimeBinaryArtifact)) { + std::string pncdir = gtgt->GetDirectory(configName); + buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", + this->CreateString(pncdir)); } if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) { @@ -1841,16 +1812,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, pnbase = gtgt->GetName(); pnsuffix = ".a"; - if (this->XcodeVersion >= 21) { - std::string pncdir = this->GetObjectsNormalDirectory( - this->CurrentProject, configName, gtgt); - buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", - this->CreateString(pncdir)); - } else { - buildSettings->AddAttribute("OBJROOT", this->CreateString(pndir)); - pndir = this->GetObjectsNormalDirectory(this->CurrentProject, configName, - gtgt); - } + std::string pncdir = + this->GetObjectsNormalDirectory(this->CurrentProject, configName, gtgt); + buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", + this->CreateString(pncdir)); } // Store the product name for all target types. @@ -1919,7 +1884,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); buildSettings->AddAttribute("INFOPLIST_FILE", this->CreateString(plist)); - } else if (this->XcodeVersion >= 22) { + } else { buildSettings->AddAttribute("MACH_O_TYPE", this->CreateString("mh_bundle")); buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC", @@ -1931,14 +1896,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, extraLinkOptions += " "; extraLinkOptions += createFlags; } - } else { - // Add the flags to create a module. - std::string createFlags = this->LookupFlags( - "CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", "-bundle"); - if (!createFlags.empty()) { - extraLinkOptions += " "; - extraLinkOptions += createFlags; - } } break; } @@ -2004,14 +1961,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, default: break; } - if (this->XcodeVersion >= 22 && this->XcodeVersion < 40) { + if (this->XcodeVersion < 40) { buildSettings->AddAttribute("PREBINDING", this->CreateString("NO")); } - BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); - BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); - BuildObjectListOrString sysdirs(this, this->XcodeVersion >= 30); - BuildObjectListOrString sysfdirs(this, this->XcodeVersion >= 30); + BuildObjectListOrString dirs(this, true); + BuildObjectListOrString fdirs(this, true); + BuildObjectListOrString sysdirs(this, true); + BuildObjectListOrString sysfdirs(this, true); const bool emitSystemIncludes = this->XcodeVersion >= 83; std::vector<std::string> includes; @@ -2242,18 +2199,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, buildSettings->AddAttribute("OTHER_REZFLAGS", this->CreateString("")); buildSettings->AddAttribute("SECTORDER_FLAGS", this->CreateString("")); buildSettings->AddAttribute("USE_HEADERMAP", this->CreateString("NO")); - if (this->XcodeVersion >= 30) { - cmXCodeObject* group = this->CreateObject(cmXCodeObject::OBJECT_LIST); - group->AddObject(this->CreateString("-Wmost")); - group->AddObject(this->CreateString("-Wno-four-char-constants")); - group->AddObject(this->CreateString("-Wno-unknown-pragmas")); - group->AddObject(this->CreateString("$(inherited)")); - buildSettings->AddAttribute("WARNING_CFLAGS", group); - } else { - buildSettings->AddAttribute( - "WARNING_CFLAGS", this->CreateString("-Wmost -Wno-four-char-constants" - " -Wno-unknown-pragmas")); - } + cmXCodeObject* group = this->CreateObject(cmXCodeObject::OBJECT_LIST); + group->AddObject(this->CreateString("-Wmost")); + group->AddObject(this->CreateString("-Wno-four-char-constants")); + group->AddObject(this->CreateString("-Wno-unknown-pragmas")); + group->AddObject(this->CreateString("$(inherited)")); + buildSettings->AddAttribute("WARNING_CFLAGS", group); // Runtime version information. if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) { @@ -2333,16 +2284,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget( this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0, gtgt); target->AddAttribute("buildPhases", buildPhases); - if (this->XcodeVersion > 20) { - this->AddConfigurations(target, gtgt); - } else { - std::string theConfig = - this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - cmXCodeObject* buildSettings = - this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - this->CreateBuildSettings(gtgt, buildSettings, theConfig); - target->AddAttribute("buildSettings", buildSettings); - } + this->AddConfigurations(target, gtgt); cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); target->AddAttribute("dependencies", dependencies); target->AddAttribute("name", this->CreateString(gtgt->GetName())); @@ -2444,8 +2386,7 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType( else if (target->IsCFBundleOnApple()) return "wrapper.plug-in"; else - return ((this->XcodeVersion >= 22) ? "compiled.mach-o.executable" - : "compiled.mach-o.dylib"); + return "compiled.mach-o.executable"; case cmStateEnums::SHARED_LIBRARY: return (target->GetPropertyAsBool("FRAMEWORK") ? "wrapper.framework" @@ -2478,9 +2419,7 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType( else if (target->IsCFBundleOnApple()) return "com.apple.product-type.bundle"; else - return ((this->XcodeVersion >= 22) - ? "com.apple.product-type.tool" - : "com.apple.product-type.library.dynamic"); + return "com.apple.product-type.tool"; case cmStateEnums::SHARED_LIBRARY: return (target->GetPropertyAsBool("FRAMEWORK") ? "com.apple.product-type.framework" @@ -2506,15 +2445,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget( cmXCodeObject* buildRules = this->CreateObject(cmXCodeObject::OBJECT_LIST); target->AddAttribute("buildRules", buildRules); std::string defConfig; - if (this->XcodeVersion > 20) { - defConfig = this->AddConfigurations(target, gtgt); - } else { - cmXCodeObject* buildSettings = - this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - defConfig = this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->CreateBuildSettings(gtgt, buildSettings, defConfig); - target->AddAttribute("buildSettings", buildSettings); - } + defConfig = this->AddConfigurations(target, gtgt); cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); target->AddAttribute("dependencies", dependencies); target->AddAttribute("name", this->CreateString(gtgt->GetName())); @@ -2533,9 +2464,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget( fullName = gtgt->GetFullName(defConfig); } fileRef->AddAttribute("path", this->CreateString(fullName)); - if (this->XcodeVersion == 15) { - fileRef->AddAttribute("refType", this->CreateString("0")); - } fileRef->AddAttribute("sourceTree", this->CreateString("BUILT_PRODUCTS_DIR")); fileRef->SetComment(gtgt->GetName()); @@ -2636,32 +2564,25 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute( cmXCodeObject* target, const char* attribute, const char* value, const std::string& configName) { - if (this->XcodeVersion < 21) { - // There is only one configuration. Add the setting to the buildSettings - // of the target. - this->AppendOrAddBuildSetting(target->GetObject("buildSettings"), - attribute, value); - } else { - // There are multiple configurations. Add the setting to the - // buildSettings of the configuration name given. - cmXCodeObject* configurationList = - target->GetObject("buildConfigurationList")->GetObject(); - cmXCodeObject* buildConfigs = - configurationList->GetObject("buildConfigurations"); - std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList(); - // each configuration and the target itself has a buildSettings in it - // list.push_back(target); - for (std::vector<cmXCodeObject*>::iterator i = list.begin(); - i != list.end(); ++i) { - if (!configName.empty()) { - if ((*i)->GetObject("name")->GetString() == configName) { - cmXCodeObject* settings = (*i)->GetObject("buildSettings"); - this->AppendOrAddBuildSetting(settings, attribute, value); - } - } else { + // There are multiple configurations. Add the setting to the + // buildSettings of the configuration name given. + cmXCodeObject* configurationList = + target->GetObject("buildConfigurationList")->GetObject(); + cmXCodeObject* buildConfigs = + configurationList->GetObject("buildConfigurations"); + std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList(); + // each configuration and the target itself has a buildSettings in it + // list.push_back(target); + for (std::vector<cmXCodeObject*>::iterator i = list.begin(); i != list.end(); + ++i) { + if (!configName.empty()) { + if ((*i)->GetObject("name")->GetString() == configName) { cmXCodeObject* settings = (*i)->GetObject("buildSettings"); this->AppendOrAddBuildSetting(settings, attribute, value); } + } else { + cmXCodeObject* settings = (*i)->GetObject("buildSettings"); + this->AppendOrAddBuildSetting(settings, attribute, value); } } } @@ -2741,13 +2662,11 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) for (std::vector<std::string>::const_iterator libDir = libDirs.begin(); libDir != libDirs.end(); ++libDir) { if (libDir->size() && *libDir != "/usr/lib") { - if (this->XcodeVersion > 15) { - // Now add the same one but append - // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it: - linkDirs += " "; - linkDirs += this->XCodeEscapePath( - *libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"); - } + // Now add the same one but append + // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it: + linkDirs += " "; + linkDirs += this->XCodeEscapePath( + *libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"); linkDirs += " "; linkDirs += this->XCodeEscapePath(*libDir); } @@ -2849,9 +2768,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent, this->CreateObject(cmXCodeObject::OBJECT_LIST); group->AddAttribute("name", this->CreateString(name)); group->AddAttribute("children", groupChildren); - if (this->XcodeVersion == 15) { - group->AddAttribute("refType", this->CreateString("4")); - } group->AddAttribute("sourceTree", this->CreateString("<group>")); if (parentChildren) parentChildren->AddObject(group); @@ -2950,50 +2866,28 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->MainGroupChildren = 0; cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO")); - cmXCodeObject* developBuildStyle = - this->CreateObject(cmXCodeObject::PBXBuildStyle); cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST); - if (this->XcodeVersion == 15) { - developBuildStyle->AddAttribute("name", this->CreateString("Development")); - developBuildStyle->AddAttribute("buildSettings", group); - listObjs->AddObject(developBuildStyle); - group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("YES")); - cmXCodeObject* deployBuildStyle = + for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) { + cmXCodeObject* buildStyle = this->CreateObject(cmXCodeObject::PBXBuildStyle); - deployBuildStyle->AddAttribute("name", this->CreateString("Deployment")); - deployBuildStyle->AddAttribute("buildSettings", group); - listObjs->AddObject(deployBuildStyle); - } else { - for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) { - cmXCodeObject* buildStyle = - this->CreateObject(cmXCodeObject::PBXBuildStyle); - const char* name = this->CurrentConfigurationTypes[i].c_str(); - buildStyle->AddAttribute("name", this->CreateString(name)); - buildStyle->SetComment(name); - cmXCodeObject* sgroup = - this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - sgroup->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO")); - buildStyle->AddAttribute("buildSettings", sgroup); - listObjs->AddObject(buildStyle); - } + const char* name = this->CurrentConfigurationTypes[i].c_str(); + buildStyle->AddAttribute("name", this->CreateString(name)); + buildStyle->SetComment(name); + cmXCodeObject* sgroup = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); + sgroup->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO")); + buildStyle->AddAttribute("buildSettings", sgroup); + listObjs->AddObject(buildStyle); } cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup); this->MainGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); mainGroup->AddAttribute("children", this->MainGroupChildren); - if (this->XcodeVersion == 15) { - mainGroup->AddAttribute("refType", this->CreateString("4")); - } mainGroup->AddAttribute("sourceTree", this->CreateString("<group>")); cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup); this->SourcesGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); sourcesGroup->AddAttribute("name", this->CreateString("Sources")); sourcesGroup->AddAttribute("children", this->SourcesGroupChildren); - if (this->XcodeVersion == 15) { - sourcesGroup->AddAttribute("refType", this->CreateString("4")); - } sourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>")); this->MainGroupChildren->AddObject(sourcesGroup); @@ -3002,9 +2896,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->CreateObject(cmXCodeObject::OBJECT_LIST); resourcesGroup->AddAttribute("name", this->CreateString("Resources")); resourcesGroup->AddAttribute("children", this->ResourcesGroupChildren); - if (this->XcodeVersion == 15) { - resourcesGroup->AddAttribute("refType", this->CreateString("4")); - } resourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>")); this->MainGroupChildren->AddObject(resourcesGroup); @@ -3015,9 +2906,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup); productGroup->AddAttribute("name", this->CreateString("Products")); - if (this->XcodeVersion == 15) { - productGroup->AddAttribute("refType", this->CreateString("4")); - } productGroup->AddAttribute("sourceTree", this->CreateString("<group>")); cmXCodeObject* productGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -3039,24 +2927,22 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->RootObject->AddAttribute("buildStyles", listObjs); this->RootObject->AddAttribute("hasScannedForEncodings", this->CreateString("0")); - if (this->XcodeVersion >= 30) { - group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - group->AddAttribute("BuildIndependentTargetsInParallel", - this->CreateString("YES")); - std::ostringstream v; - v << std::setfill('0') << std::setw(4) << XcodeVersion * 10; - group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str())); - this->RootObject->AddAttribute("attributes", group); - if (this->XcodeVersion >= 32) - this->RootObject->AddAttribute("compatibilityVersion", - this->CreateString("Xcode 3.2")); - else if (this->XcodeVersion >= 31) - this->RootObject->AddAttribute("compatibilityVersion", - this->CreateString("Xcode 3.1")); - else - this->RootObject->AddAttribute("compatibilityVersion", - this->CreateString("Xcode 3.0")); - } + group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); + group->AddAttribute("BuildIndependentTargetsInParallel", + this->CreateString("YES")); + std::ostringstream v; + v << std::setfill('0') << std::setw(4) << XcodeVersion * 10; + group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str())); + this->RootObject->AddAttribute("attributes", group); + if (this->XcodeVersion >= 32) + this->RootObject->AddAttribute("compatibilityVersion", + this->CreateString("Xcode 3.2")); + else if (this->XcodeVersion >= 31) + this->RootObject->AddAttribute("compatibilityVersion", + this->CreateString("Xcode 3.1")); + else + this->RootObject->AddAttribute("compatibilityVersion", + this->CreateString("Xcode 3.0")); // Point Xcode at the top of the source tree. { std::string pdir = @@ -3071,26 +2957,15 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( typedef std::vector<std::pair<std::string, cmXCodeObject*> > Configs; Configs configs; const char* defaultConfigName = "Debug"; - if (this->XcodeVersion == 15) { - cmXCodeObject* configDebug = - this->CreateObject(cmXCodeObject::XCBuildConfiguration); - configDebug->AddAttribute("name", this->CreateString("Debug")); - configs.push_back(std::make_pair("Debug", configDebug)); - cmXCodeObject* configRelease = - this->CreateObject(cmXCodeObject::XCBuildConfiguration); - configRelease->AddAttribute("name", this->CreateString("Release")); - configs.push_back(std::make_pair("Release", configRelease)); - } else { - for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) { - const char* name = this->CurrentConfigurationTypes[i].c_str(); - if (0 == i) { - defaultConfigName = name; - } - cmXCodeObject* config = - this->CreateObject(cmXCodeObject::XCBuildConfiguration); - config->AddAttribute("name", this->CreateString(name)); - configs.push_back(std::make_pair(name, config)); + for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) { + const char* name = this->CurrentConfigurationTypes[i].c_str(); + if (0 == i) { + defaultConfigName = name; } + cmXCodeObject* config = + this->CreateObject(cmXCodeObject::XCBuildConfiguration); + config->AddAttribute("name", this->CreateString(name)); + configs.push_back(std::make_pair(name, config)); } for (Configs::iterator c = configs.begin(); c != configs.end(); ++c) { buildConfigurations->AddObject(c->second); @@ -3247,22 +3122,12 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) void cmGlobalXCodeGenerator::ComputeObjectDirArch() { - if (this->XcodeVersion >= 21) { - if (this->Architectures.size() > 1) { - this->ObjectDirArch = "$(CURRENT_ARCH)"; - } else if (!this->Architectures.empty()) { - this->ObjectDirArch = this->Architectures[0]; - } else { - this->ObjectDirArch = this->ObjectDirArchDefault; - } + if (this->Architectures.size() > 1) { + this->ObjectDirArch = "$(CURRENT_ARCH)"; + } else if (!this->Architectures.empty()) { + this->ObjectDirArch = this->Architectures[0]; } else { -#if defined(__ppc__) - this->ObjectDirArch = "ppc"; -#elif defined(__i386) - this->ObjectDirArch = "i386"; -#else - this->ObjectDirArch = ""; -#endif + this->ObjectDirArch = this->ObjectDirArchDefault; } } @@ -3432,10 +3297,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( std::string xcodeDir = root->GetCurrentBinaryDirectory(); xcodeDir += "/"; xcodeDir += root->GetProjectName(); - xcodeDir += ".xcode"; - if (this->XcodeVersion > 20) { - xcodeDir += "proj"; - } + xcodeDir += ".xcodeproj"; cmSystemTools::MakeDirectory(xcodeDir.c_str()); std::string xcodeProjFile = xcodeDir + "/project.pbxproj"; cmGeneratedFileStream fout(xcodeProjFile.c_str()); @@ -3524,20 +3386,13 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmXCodeObject::Indent(1, fout); fout << "};\n"; cmXCodeObject::Indent(1, fout); - if (this->XcodeVersion >= 21) { - if (this->XcodeVersion >= 32) - fout << "objectVersion = 46;\n"; - else if (this->XcodeVersion >= 31) - fout << "objectVersion = 45;\n"; - else if (this->XcodeVersion >= 30) - fout << "objectVersion = 44;\n"; - else - fout << "objectVersion = 42;\n"; - cmXCode21Object::PrintList(this->XCodeObjects, fout); - } else { - fout << "objectVersion = 39;\n"; - cmXCodeObject::PrintList(this->XCodeObjects, fout); - } + if (this->XcodeVersion >= 32) + fout << "objectVersion = 46;\n"; + else if (this->XcodeVersion >= 31) + fout << "objectVersion = 45;\n"; + else + fout << "objectVersion = 44;\n"; + cmXCode21Object::PrintList(this->XCodeObjects, fout); cmXCodeObject::Indent(1, fout); fout << "rootObject = " << this->RootObject->GetId() << " /* Project object */;\n"; @@ -3546,9 +3401,7 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const { - return this->XcodeVersion >= 21 - ? "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" - : "."; + return "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; } std::string cmGlobalXCodeGenerator::ExpandCFGIntDir( @@ -3611,12 +3464,10 @@ void cmGlobalXCodeGenerator::AppendDirectoryForConfig( const std::string& prefix, const std::string& config, const std::string& suffix, std::string& dir) { - if (this->XcodeVersion > 20) { - if (!config.empty()) { - dir += prefix; - dir += config; - dir += suffix; - } + if (!config.empty()) { + dir += prefix; + dir += config; + dir += suffix; } } @@ -3741,11 +3592,6 @@ std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation( // i.e. "Can I build Debug and Release in the same tree?" bool cmGlobalXCodeGenerator::IsMultiConfig() const { - // Old Xcode 1.5 is single config: - if (this->XcodeVersion == 15) { - return false; - } - // Newer Xcode versions are multi config: return true; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index a733d5c..ee06074 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -32,7 +32,8 @@ struct cmDocumentationEntry; class cmGlobalXCodeGenerator : public cmGlobalGenerator { public: - cmGlobalXCodeGenerator(cmake* cm, std::string const& version); + cmGlobalXCodeGenerator(cmake* cm, std::string const& version_string, + unsigned int version_number); static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h index 527db16..46cf878 100644 --- a/Source/cmGraphAdjacencyList.h +++ b/Source/cmGraphAdjacencyList.h @@ -15,26 +15,11 @@ class cmGraphEdge { public: - cmGraphEdge() - : Dest(0) - , Strong(true) - { - } - cmGraphEdge(int n) - : Dest(n) - , Strong(true) - { - } - cmGraphEdge(int n, bool s) + cmGraphEdge(int n = 0, bool s = true) : Dest(n) , Strong(s) { } - cmGraphEdge(cmGraphEdge const& r) - : Dest(r.Dest) - , Strong(r.Strong) - { - } operator int() const { return this->Dest; } bool IsStrong() const { return this->Strong; } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 16297f3..929b1cd 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -16,7 +16,7 @@ struct cmListFileParser { - cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, + cmListFileParser(cmListFile* lf, cmListFileBacktrace const& lfbt, cmMessenger* messenger, const char* filename); ~cmListFileParser(); void IssueFileOpenError(std::string const& text) const; @@ -39,7 +39,8 @@ struct cmListFileParser } Separation; }; -cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, +cmListFileParser::cmListFileParser(cmListFile* lf, + cmListFileBacktrace const& lfbt, cmMessenger* messenger, const char* filename) : ListFile(lf) diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index bda4ea3..aa11ba7 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -45,12 +45,6 @@ struct cmListFileArgument , Line(0) { } - cmListFileArgument(const cmListFileArgument& r) - : Value(r.Value) - , Delim(r.Delim) - , Line(r.Line) - { - } cmListFileArgument(const std::string& v, Delimiter d, long line) : Value(v) , Delim(d) diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 00f5e4b..e0e3e54 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -281,9 +281,11 @@ void cmLocalNinjaGenerator::AppendTargetOutputs(cmGeneratorTarget* target, } void cmLocalNinjaGenerator::AppendTargetDepends(cmGeneratorTarget* target, - cmNinjaDeps& outputs) + cmNinjaDeps& outputs, + cmNinjaTargetDepends depends) { - this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs); + this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs, + depends); } void cmLocalNinjaGenerator::AppendCustomCommandDeps( diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index fda4578..a45e018 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -63,7 +63,9 @@ public: std::string BuildCommandLine(const std::vector<std::string>& cmdLines); void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs); - void AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs); + void AppendTargetDepends( + cmGeneratorTarget* target, cmNinjaDeps& outputs, + cmNinjaTargetDepends depends = DependOnTargetArtifact); void AddCustomCommandTarget(cmCustomCommand const* cc, cmGeneratorTarget* target); diff --git a/Source/cmLocale.h b/Source/cmLocale.h index b98009f..086f448 100644 --- a/Source/cmLocale.h +++ b/Source/cmLocale.h @@ -10,8 +10,6 @@ class cmLocaleRAII { - std::string OldLocale; - public: cmLocaleRAII() : OldLocale(setlocale(LC_CTYPE, CM_NULLPTR)) @@ -19,6 +17,12 @@ public: setlocale(LC_CTYPE, ""); } ~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale.c_str()); } + +private: + cmLocaleRAII(cmLocaleRAII const&); + cmLocaleRAII& operator=(cmLocaleRAII const&); + + std::string OldLocale; }; #endif diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 7c417a4..e0b2217 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -117,7 +117,7 @@ bool cmNinjaTargetGenerator::NeedDyndep(std::string const& lang) const std::string cmNinjaTargetGenerator::OrderDependsTargetForTarget() { - return "cmake_order_depends_target_" + this->GetTargetName(); + return "cmake_object_order_depends_target_" + this->GetTargetName(); } // TODO: Most of the code is picked up from @@ -718,8 +718,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() } cmNinjaDeps orderOnlyDeps; - this->GetLocalGenerator()->AppendTargetDepends(this->GeneratorTarget, - orderOnlyDeps); + this->GetLocalGenerator()->AppendTargetDepends( + this->GeneratorTarget, orderOnlyDeps, DependOnTargetOrdering); // Add order-only dependencies on other files associated with the target. orderOnlyDeps.insert(orderOnlyDeps.end(), this->ExtraFiles.begin(), @@ -740,7 +740,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() std::back_inserter(orderOnlyDeps), MapToNinjaPath()); } - if (!orderOnlyDeps.empty()) { + std::sort(orderOnlyDeps.begin(), orderOnlyDeps.end()); + orderOnlyDeps.erase(std::unique(orderOnlyDeps.begin(), orderOnlyDeps.end()), + orderOnlyDeps.end()); + + { cmNinjaDeps orderOnlyTarget; orderOnlyTarget.push_back(this->OrderDependsTargetForTarget()); this->GetGlobalGenerator()->WritePhonyBuild( @@ -753,7 +757,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() for (std::vector<cmSourceFile const*>::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { - this->WriteObjectBuildStatement(*si, !orderOnlyDeps.empty()); + this->WriteObjectBuildStatement(*si); } if (!this->DDIFiles.empty()) { @@ -770,6 +774,17 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() ddOutputs.push_back(this->GetDyndepFilePath("Fortran")); + // Make sure dyndep files for all our dependencies have already + // been generated so that the 'FortranModules.json' files they + // produced as side-effects are available for us to read. + // Ideally we should depend on the 'FortranModules.json' files + // from our dependencies directly, but we don't know which of + // our dependencies produces them. Fixing this will require + // refactoring the Ninja generator to generate targets in + // dependency order so that we can collect the needed information. + this->GetLocalGenerator()->AppendTargetDepends( + this->GeneratorTarget, ddOrderOnlyDeps, DependOnTargetArtifact); + this->GetGlobalGenerator()->WriteBuild( this->GetBuildFileStream(), ddComment, ddRule, ddOutputs, ddImplicitOuts, ddExplicitDeps, ddImplicitDeps, ddOrderOnlyDeps, ddVars); @@ -779,7 +794,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() } void cmNinjaTargetGenerator::WriteObjectBuildStatement( - cmSourceFile const* source, bool writeOrderDependsTargetForTarget) + cmSourceFile const* source) { std::string const language = source->GetLanguage(); std::string const sourceFileName = @@ -830,9 +845,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( } cmNinjaDeps orderOnlyDeps; - if (writeOrderDependsTargetForTarget) { - orderOnlyDeps.push_back(this->OrderDependsTargetForTarget()); - } + 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 9ce8651..5eb7a9a 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -119,8 +119,7 @@ protected: void WriteLanguageRules(const std::string& language); void WriteCompileRule(const std::string& language); void WriteObjectBuildStatements(); - void WriteObjectBuildStatement(cmSourceFile const* source, - bool writeOrderDependsTargetForTarget); + void WriteObjectBuildStatement(cmSourceFile const* source); void WriteTargetDependInfo(std::string const& lang); void ExportObjectCompileCommand( diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h index b4af70e..ec435d9 100644 --- a/Source/cmNinjaTypes.h +++ b/Source/cmNinjaTypes.h @@ -9,6 +9,12 @@ #include <string> #include <vector> +enum cmNinjaTargetDepends +{ + DependOnTargetArtifact, + DependOnTargetOrdering +}; + typedef std::vector<std::string> cmNinjaDeps; typedef std::map<std::string, std::string> cmNinjaVars; diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 8b8cf07..2339d68 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -188,9 +188,8 @@ protected: if (qstart == std::string::npos) { cmSystemTools::Error("unknown include directive ", line.c_str()); continue; - } else { - qend = line.find('>', qstart + 1); } + qend = line.find('>', qstart + 1); } else { qend = line.find('\"', qstart + 1); } diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 70ffc7d..938cad9 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -96,14 +96,14 @@ void cmRST::ProcessModule(std::istream& is) if (line == "#") { this->ProcessLine(""); continue; - } else if (line.substr(0, 2) == "# ") { + } + if (line.substr(0, 2) == "# ") { this->ProcessLine(line.substr(2, line.npos)); continue; - } else { - rst = ""; - this->Reset(); - this->OutputLinePending = true; } + rst = ""; + this->Reset(); + this->OutputLinePending = true; } if (line == "#.rst:") { rst = "#"; diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index da26972..6425913 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -32,9 +32,8 @@ bool cmSetTargetPropertiesCommand::InitialPass( } propertyPairs.insert(propertyPairs.end(), j, args.end()); break; - } else { - numFiles++; } + numFiles++; } if (propertyPairs.empty()) { this->SetError("called with illegal arguments, maybe missing " diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index 4fd379f..e27c675 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -32,9 +32,8 @@ bool cmSetTestsPropertiesCommand::InitialPass( } propertyPairs.insert(propertyPairs.end(), j, args.end()); break; - } else { - numFiles++; } + numFiles++; } if (propertyPairs.empty()) { this->SetError("called with illegal arguments, maybe " diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 631f2a6..f54d777 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmSourceGroupCommand.h" +#include <algorithm> +#include <iterator> #include <set> #include <sstream> #include <stddef.h> @@ -36,21 +38,31 @@ std::string getFullFilePath(const std::string& currentPath, } std::set<std::string> getSourceGroupFilesPaths( - const std::string& currentPath, const std::string& root, - const std::vector<std::string>& files) + const std::string& root, const std::vector<std::string>& files) { std::set<std::string> ret; const std::string::size_type rootLength = root.length(); for (size_t i = 0; i < files.size(); ++i) { - const std::string fullPath = getFullFilePath(currentPath, files[i]); - - ret.insert(fullPath.substr(rootLength + 1)); // +1 to also omnit last '/' + ret.insert(files[i].substr(rootLength + 1)); // +1 to also omnit last '/' } return ret; } +bool rootIsPrefix(const std::string& root, + const std::vector<std::string>& files, std::string& error) +{ + for (size_t i = 0; i < files.size(); ++i) { + if (!cmSystemTools::StringStartsWith(files[i], root.c_str())) { + error = "ROOT: " + root + " is not a prefix of file: " + files[i]; + return false; + } + } + + return true; +} + cmSourceGroup* addSourceGroup(const std::vector<std::string>& tokenizedPath, cmMakefile& makefile) { @@ -68,7 +80,22 @@ cmSourceGroup* addSourceGroup(const std::vector<std::string>& tokenizedPath, return sg; } -bool addFilesToItsSourceGroups(const std::set<std::string>& sgFilesPaths, +std::string prepareFilePathForTree(const std::string& path) +{ + return cmSystemTools::CollapseFullPath(path); +} + +std::vector<std::string> prepareFilesPathsForTree( + std::vector<std::string>::const_iterator begin, + std::vector<std::string>::const_iterator end) +{ + std::vector<std::string> prepared(std::distance(begin, end)); + std::transform(begin, end, prepared.begin(), prepareFilePathForTree); + return prepared; +} + +bool addFilesToItsSourceGroups(const std::string& root, + const std::set<std::string>& sgFilesPaths, const std::string& prefix, cmMakefile& makefile, std::string& errorMsg) { @@ -93,8 +120,7 @@ bool addFilesToItsSourceGroups(const std::set<std::string>& sgFilesPaths, errorMsg = "Could not create source group for file: " + *it; return false; } - const std::string fullPath = - getFullFilePath(makefile.GetCurrentSourceDirectory(), *it); + const std::string fullPath = getFullFilePath(root, *it); sg->AddGroupFile(fullPath); } } @@ -233,17 +259,18 @@ bool cmSourceGroupCommand::processTree(const std::vector<std::string>& args, filesBegin = FilesWithPrefixKeywordIndex + 1; } - const std::vector<std::string> filesVector(args.begin() + filesBegin, - args.end()); + const std::vector<std::string> filesVector = + prepareFilesPathsForTree(args.begin() + filesBegin, args.end()); - std::set<std::string> sourceGroupPaths = getSourceGroupFilesPaths( - this->Makefile->GetCurrentSourceDirectory(), root, filesVector); + if (!rootIsPrefix(root, filesVector, errorMsg)) { + return false; + } - addFilesToItsSourceGroups(sourceGroupPaths, prefix, *(this->Makefile), - errorMsg); + std::set<std::string> sourceGroupPaths = + getSourceGroupFilesPaths(root, filesVector); - if (!errorMsg.empty()) { - this->SetError(errorMsg); + if (!addFilesToItsSourceGroups(root, sourceGroupPaths, prefix, + *(this->Makefile), errorMsg)) { return false; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 39625ae..6d620d9 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1707,7 +1707,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, for (; outiter != out.end(); ++outiter) { if ((*outiter == '\r') && ((outiter + 1) == out.end())) { break; - } else if (*outiter == '\n' || *outiter == '\0') { + } + if (*outiter == '\n' || *outiter == '\0') { std::vector<char>::size_type length = outiter - out.begin(); if (length > 1 && *(outiter - 1) == '\r') { --length; @@ -1724,7 +1725,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, for (; erriter != err.end(); ++erriter) { if ((*erriter == '\r') && ((erriter + 1) == err.end())) { break; - } else if (*erriter == '\n' || *erriter == '\0') { + } + if (*erriter == '\n' || *erriter == '\0') { std::vector<char>::size_type length = erriter - err.begin(); if (length > 1 && *(erriter - 1) == '\r') { --length; @@ -2623,29 +2625,28 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, it = dentries.erase(it); entriesErased++; continue; - } else { - if (cmELF::TagMipsRldMapRel != 0 && - it->first == cmELF::TagMipsRldMapRel) { - // Background: debuggers need to know the "linker map" which contains - // the addresses each dynamic object is loaded at. Most arches use - // the DT_DEBUG tag which the dynamic linker writes to (directly) and - // contain the location of the linker map, however on MIPS the - // .dynamic section is always read-only so this is not possible. MIPS - // objects instead contain a DT_MIPS_RLD_MAP tag which contains the - // address where the dyanmic linker will write to (an indirect - // version of DT_DEBUG). Since this doesn't work when using PIE, a - // relative equivalent was created - DT_MIPS_RLD_MAP_REL. Since this - // version contains a relative offset, moving it changes the - // calculated address. This may cause the dyanmic linker to write - // into memory it should not be changing. - // - // To fix this, we adjust the value of DT_MIPS_RLD_MAP_REL here. If - // we move it up by n bytes, we add n bytes to the value of this tag. - it->second += entriesErased * sizeof_dentry; - } - - it++; } + if (cmELF::TagMipsRldMapRel != 0 && + it->first == cmELF::TagMipsRldMapRel) { + // Background: debuggers need to know the "linker map" which contains + // the addresses each dynamic object is loaded at. Most arches use + // the DT_DEBUG tag which the dynamic linker writes to (directly) and + // contain the location of the linker map, however on MIPS the + // .dynamic section is always read-only so this is not possible. MIPS + // objects instead contain a DT_MIPS_RLD_MAP tag which contains the + // address where the dyanmic linker will write to (an indirect + // version of DT_DEBUG). Since this doesn't work when using PIE, a + // relative equivalent was created - DT_MIPS_RLD_MAP_REL. Since this + // version contains a relative offset, moving it changes the + // calculated address. This may cause the dyanmic linker to write + // into memory it should not be changing. + // + // To fix this, we adjust the value of DT_MIPS_RLD_MAP_REL here. If + // we move it up by n bytes, we add n bytes to the value of this tag. + it->second += entriesErased * sizeof_dentry; + } + + it++; } // Encode new entries list diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index a8a9995..3ba2c22 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -381,9 +381,12 @@ public: { public: SaveRestoreEnvironment(); - virtual ~SaveRestoreEnvironment(); + ~SaveRestoreEnvironment(); private: + SaveRestoreEnvironment(SaveRestoreEnvironment const&); + SaveRestoreEnvironment& operator=(SaveRestoreEnvironment const&); + std::vector<std::string> Env; }; #endif diff --git a/Source/cmake.h b/Source/cmake.h index 4c292f0..6a6beb4 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -409,7 +409,7 @@ public: void WatchUnusedCli(const std::string& var); cmState* GetState() const { return this->State; } - void SetCurrentSnapshot(cmStateSnapshot snapshot) + void SetCurrentSnapshot(cmStateSnapshot const& snapshot) { this->CurrentSnapshot = snapshot; } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 974dd5f..cc954e6 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1450,7 +1450,8 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg, if (*arg == "--") { ++arg; break; - } else if (*arg == "--manifests") { + } + if (*arg == "--manifests") { for (++arg; arg != argEnd && !cmHasLiteralPrefix(*arg, "-"); ++arg) { this->UserManifests.push_back(*arg); } diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index d680205..d1a1df5 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -34,16 +34,6 @@ target_link_libraries(CMakeLibTests CMakeLib) add_executable(testEncoding testEncoding.cxx) target_link_libraries(testEncoding cmsys) -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE - AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command( - TARGET CMakeLibTests - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) -endif() - foreach(test ${CMakeLib_TESTS}) add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS}) endforeach() diff --git a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt index c53befc..7c84ee1 100644 --- a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt +++ b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt @@ -24,18 +24,3 @@ target_link_libraries(memcheck_fail CMakeLib) # output file. Need to be in their own subdirectory as they have the # same filenames. add_subdirectory(NoLog) - -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - foreach(t - memcheck_fail - pseudo_BC - pseudo_purify - pseudo_valgrind - ) - add_custom_command(TARGET ${t} - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - endforeach() -endif() diff --git a/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt index 3a45bfe..e47b9db 100644 --- a/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt +++ b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt @@ -11,12 +11,4 @@ configure_file( foreach(_pseudo IN ITEMS valgrind purify BC) add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") set_target_properties(pseudonl_${_pseudo} PROPERTIES OUTPUT_NAME ${_pseudo}) - - # Xcode 2.x forgets to create the output directory before linking - # the individual architectures. - if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command(TARGET pseudonl_${_pseudo} - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - endif() endforeach() diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 7eb679c..443d366 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -1,10 +1,6 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required(VERSION 2.8.4) # new enough for CMP0017 project(AllFindModules) -if (POLICY CMP0017) - cmake_policy(SET CMP0017 NEW) -endif () - # Avoid ctest truncation of output message(STATUS "CTEST_FULL_OUTPUT") diff --git a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt index f917cd7..4975feb 100644 --- a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt +++ b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt @@ -19,6 +19,7 @@ add_executable(working "${TestWorkingDir_BINARY_DIR}/working.c" add_custom_target( Custom ALL COMMAND "${CMAKE_COMMAND}" -E copy_if_different ./customTarget.c "${TestWorkingDir_BINARY_DIR}/customTarget.c" + BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/customTarget.c" WORKING_DIRECTORY "${TestWorkingDir_SOURCE_DIR}" ) @@ -36,6 +37,7 @@ add_executable(working2 working2.c ${TestWorkingDir_BINARY_DIR}/customTarget2.c) add_custom_target( Custom2 ALL COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${TestWorkingDir_SOURCE_DIR}/customTarget.c ../customTarget2.c + BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/customTarget2.c" WORKING_DIRECTORY work/ # Relative to build tree, trailing slash ) diff --git a/Tests/FindModulesExecuteAll/CMakeLists.txt b/Tests/FindModulesExecuteAll/CMakeLists.txt index 21b9d38..4893bb3 100644 --- a/Tests/FindModulesExecuteAll/CMakeLists.txt +++ b/Tests/FindModulesExecuteAll/CMakeLists.txt @@ -6,8 +6,8 @@ # # I guess more things could be added, like checking whether variables are # defined after running the modules (e.g. FOO_FOUND etc.). +cmake_minimum_required(VERSION 2.8.4) # new enough for CMP0017 project(FindModulesExecuteAll) -cmake_minimum_required(VERSION 2.7) file(GLOB all_modules "${CMAKE_CURRENT_SOURCE_DIR}/../../Modules/Find*cmake") diff --git a/Tests/JavaExportImport/BuildExport/CMakeLists.txt b/Tests/JavaExportImport/BuildExport/CMakeLists.txt index 953f9d0..fa7e501 100644 --- a/Tests/JavaExportImport/BuildExport/CMakeLists.txt +++ b/Tests/JavaExportImport/BuildExport/CMakeLists.txt @@ -7,4 +7,7 @@ find_package(Java COMPONENTS Development) include(UseJava) add_jar(${PROJECT_NAME} Foo.java) -export_jars(TARGETS ${PROJECT_NAME} FILE JavaBuildExportTestConfig.cmake) +export_jars( + TARGETS ${PROJECT_NAME} + NAMESPACE foo:: + FILE JavaBuildExportTestConfig.cmake) diff --git a/Tests/JavaExportImport/Import/CMakeLists.txt b/Tests/JavaExportImport/Import/CMakeLists.txt index 79a1447..13ec05d 100644 --- a/Tests/JavaExportImport/Import/CMakeLists.txt +++ b/Tests/JavaExportImport/Import/CMakeLists.txt @@ -11,4 +11,4 @@ find_package(JavaInstallExportTest REQUIRED) add_jar(${PROJECT_NAME} SOURCES Import.java - INCLUDE_JARS foo bar) + INCLUDE_JARS foo::foo bar::bar) diff --git a/Tests/JavaExportImport/InstallExport/CMakeLists.txt b/Tests/JavaExportImport/InstallExport/CMakeLists.txt index 0a9afd9..2923beb 100644 --- a/Tests/JavaExportImport/InstallExport/CMakeLists.txt +++ b/Tests/JavaExportImport/InstallExport/CMakeLists.txt @@ -10,5 +10,6 @@ add_jar(${PROJECT_NAME} Bar.java) install_jar(${PROJECT_NAME} DESTINATION share/java) install_jar_exports( TARGETS ${PROJECT_NAME} + NAMESPACE bar:: FILE JavaInstallExportTestConfig.cmake DESTINATION share/cmake) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 32c4be8..7db5243 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -63,15 +63,6 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1) set(Swift_ARGS -DXCODE_BELOW_6_1=1) endif() -if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) - set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) -endif() - -if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) - set(TargetSources_ARGS -DXCODE_BELOW_2=1) - set(File_Generate_ARGS -DXCODE_BELOW_2=1) -endif() - # Test MSVC for older host CMake versions, and test # WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows. if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel")) @@ -119,6 +110,10 @@ if(CMAKE_GENERATOR MATCHES "Make") add_RunCMake_test(Make) endif() if(CMAKE_GENERATOR STREQUAL "Ninja") + set(Ninja_ARGS + -DCMAKE_C_OUTPUT_EXTENSION=${CMAKE_C_OUTPUT_EXTENSION} + -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX} + -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}) add_RunCMake_test(Ninja) endif() add_RunCMake_test(CTest) @@ -280,7 +275,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^89]|[89][0-9])") add_RunCMake_test(VS10Project) endif() -if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3) +if(XCODE_VERSION) add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}) endif() @@ -328,19 +323,6 @@ add_executable(pseudo_emulator_custom_command pseudo_emulator_custom_command.c) add_RunCMake_test(CrosscompilingEmulator -DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator> -DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command>) -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command( - TARGET pseudo_emulator - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - add_custom_command( - TARGET pseudo_emulator_custom_command - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) -endif() - if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if(UNIX AND NOT CYGWIN) execute_process(COMMAND ldd --help diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-OFF.cmake diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt new file mode 100644 index 0000000..2f2cbd3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning: + The "Visual Studio 8 2005" generator is deprecated and will be removed in a + future version of CMake. + + Add CMAKE_WARN_VS8=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS8-WARN-ON.cmake diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f327f78..f94b10a 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -78,6 +78,13 @@ if(RunCMake_GENERATOR STREQUAL "Ninja") unset(RunCMake_TEST_NO_CLEAN) endif() +if(RunCMake_GENERATOR MATCHES "^Visual Studio 8 2005") + set(RunCMake_WARN_VS8 1) + run_cmake(DeprecateVS8-WARN-ON) + unset(RunCMake_WARN_VS8) + run_cmake(DeprecateVS8-WARN-OFF) +endif() + if(UNIX) run_cmake_command(E_create_symlink-no-arg ${CMAKE_COMMAND} -E create_symlink diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index db344ef..82e903d 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -1,7 +1,7 @@ include(RunCMake) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index f6449f2..f89100e 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -31,7 +31,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") endif() set(RunCMake_GENERATOR_TOOLSET "Test Toolset,not_a_key") run_cmake(BadToolsetFormat) -elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode" AND NOT XCODE_BELOW_3) +elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode") set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") @@ -47,7 +47,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode") 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/Ninja/AssumedSources.cmake b/Tests/RunCMake/Ninja/AssumedSources.cmake new file mode 100644 index 0000000..5fb0219 --- /dev/null +++ b/Tests/RunCMake/Ninja/AssumedSources.cmake @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.8) +project(AssumedSources) + +set_source_files_properties( + "${CMAKE_CURRENT_BINARY_DIR}/target.c" + "${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c" + PROPERTIES GENERATED 1) + +add_executable(working + "${CMAKE_CURRENT_BINARY_DIR}/target.c" + "${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c") + +add_custom_target( + gen-target.c ALL + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/dep.c" "${CMAKE_CURRENT_BINARY_DIR}/target.c") +add_custom_target( + gen-target-no-depends.c ALL + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/dep.c" "${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c") + +add_dependencies(working gen-target.c) diff --git a/Tests/RunCMake/Ninja/LooseObjectDepends.cmake b/Tests/RunCMake/Ninja/LooseObjectDepends.cmake new file mode 100644 index 0000000..360c7ba --- /dev/null +++ b/Tests/RunCMake/Ninja/LooseObjectDepends.cmake @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.8) +project(LooseObjectDepends C) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/command.h" + COMMAND "${CMAKE_COMMAND}" -E touch + "${CMAKE_CURRENT_BINARY_DIR}/command.h" + COMMENT "Creating command.h") +add_custom_target(create-command.h + DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/command.h") + +add_custom_target(create-target.h + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/target.h" + COMMAND "${CMAKE_COMMAND}" -E touch + "${CMAKE_CURRENT_BINARY_DIR}/target.h" + COMMENT "Creating target.h") + +add_library(dep SHARED dep.c) +add_dependencies(dep create-command.h create-target.h) +target_include_directories(dep + PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}") + +add_library(top top.c) +target_link_libraries(top PRIVATE dep) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 7b4e51e..8c3bc20 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -73,7 +73,7 @@ run_SubDir() function(run_ninja dir) execute_process( - COMMAND "${RunCMake_MAKE_PROGRAM}" + COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN} WORKING_DIRECTORY "${dir}" OUTPUT_VARIABLE ninja_stdout ERROR_VARIABLE ninja_stderr @@ -95,6 +95,39 @@ ${ninja_stderr} endif() endfunction(run_ninja) +function (run_LooseObjectDepends) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LooseObjectDepends-build) + run_cmake(LooseObjectDepends) + run_ninja("${RunCMake_TEST_BINARY_DIR}" "CMakeFiles/top.dir/top.c${CMAKE_C_OUTPUT_EXTENSION}") + if (EXISTS "${RunCMake_TEST_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}dep${CMAKE_SHARED_LIBRARY_SUFFIX}") + message(FATAL_ERROR + "The `dep` library was created when requesting an object file to be " + "built; this should no longer be necessary.") + endif () + if (EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/dep.dir/dep.c${CMAKE_C_OUTPUT_EXTENSION}") + message(FATAL_ERROR + "The `dep.c` object file was created when requesting an object file to " + "be built; this should no longer be necessary.") + endif () +endfunction () +run_LooseObjectDepends() + +function (run_AssumedSources) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AssumedSources-build) + run_cmake(AssumedSources) + run_ninja("${RunCMake_TEST_BINARY_DIR}" "target.c") + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/target.c") + message(FATAL_ERROR + "Dependencies for an assumed source did not hook up properly for 'target.c'.") + endif () + run_ninja("${RunCMake_TEST_BINARY_DIR}" "target-no-depends.c") + if (EXISTS "${RunCMake_TEST_BINARY_DIR}/target-no-depends.c") + message(FATAL_ERROR + "Dependencies for an assumed source were magically hooked up for 'target-no-depends.c'.") + endif () +endfunction () +run_AssumedSources() + function(sleep delay) execute_process( COMMAND ${CMAKE_COMMAND} -E sleep ${delay} diff --git a/Tests/RunCMake/Ninja/dep.c b/Tests/RunCMake/Ninja/dep.c new file mode 100644 index 0000000..728f031 --- /dev/null +++ b/Tests/RunCMake/Ninja/dep.c @@ -0,0 +1,4 @@ +int dep() +{ + return 0; +} diff --git a/Tests/RunCMake/Ninja/top.c b/Tests/RunCMake/Ninja/top.c new file mode 100644 index 0000000..4a88eb2 --- /dev/null +++ b/Tests/RunCMake/Ninja/top.c @@ -0,0 +1,7 @@ +#include "command.h" +#include "target.h" + +int top() +{ + return 0; +} diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 04eadd5..26312c4 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -51,6 +51,9 @@ function(run_cmake test) if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() + if(RunCMake_GENERATOR MATCHES "^Visual Studio 8 2005" AND NOT RunCMake_WARN_VS8) + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_WARN_VS8=OFF) + endif() if(RunCMake_MAKE_PROGRAM) list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 4416ef9..bb55a6e 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) +if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") run_cmake(ConfigNotAllowed) run_cmake(OriginDebugIDE) else() |