Merge topic 'cleanup-build-commands'

4cce44b Help: Document the CMAKE_MAKE_PROGRAM variable in more detail
558c74d VS: Switch to internal CMAKE_MAKE_PROGRAM lookup by generators
5229f2d Tests: Do not use an explicit make program for VS generators
72dd738 Tests: Fix MFC test heuristic for empty CMAKE_TEST_MAKEPROGRAM
fd6076d Tests: Pass CMAKE_MAKE_PROGRAM instead of --build-makeprogram
68031ab Tests: Configure SubProject-Stage2 test more robustly
003d10c Tests: Simplify VSExcludeFromDefaultBuild configuration
e47d934 Tests: Simplify VSProjectInSubdir configuration
e965cb1 Tests: Simplify CTest.BuildCommand.ProjectInSubdir configuration
72bf255 Tests: Pass --build-options to every test
4d1d772 ctest: Teach --build-options to allow zero options
96966b5 ctest: Make the --build-makeprogram optional for --build-and-test
91a0211 Simplify some calls to cmGlobalGenerator::Build
123a060 Teach GenerateBuildCommand to find its own make program
5f5c92b VS: Add internal APIs to find MSBuild, devenv/VCExpress, and msdev
4ac75fd Prefer CMAKE_MAKE_PROGRAM over CMAKE_BUILD_TOOL (#14548)
...
This commit is contained in:
Brad King 2013-11-19 10:55:39 -05:00 committed by CMake Topic Stage
commit 1da77bf1ee
65 changed files with 897 additions and 1046 deletions

View File

@ -113,10 +113,6 @@ endif()
# for testing. Simply to improve readability of the main script. # for testing. Simply to improve readability of the main script.
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
macro(CMAKE_SETUP_TESTING) macro(CMAKE_SETUP_TESTING)
if (NOT DART_ROOT)
set(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
endif ()
if(BUILD_TESTING) if(BUILD_TESTING)
set(CMAKE_TEST_GENERATOR "" CACHE STRING set(CMAKE_TEST_GENERATOR "" CACHE STRING
"Generator used when running tests") "Generator used when running tests")
@ -125,7 +121,6 @@ macro(CMAKE_SETUP_TESTING)
if(NOT CMAKE_TEST_GENERATOR) if(NOT CMAKE_TEST_GENERATOR)
set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}") set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}")
set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}") set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}")
set(CMAKE_TEST_MAKEPROGRAM "${MAKEPROGRAM}")
else() else()
set(CMAKE_TEST_DIFFERENT_GENERATOR TRUE) set(CMAKE_TEST_DIFFERENT_GENERATOR TRUE)
set(CMAKE_TEST_GENERATOR_TOOLSET "") set(CMAKE_TEST_GENERATOR_TOOLSET "")

View File

@ -1,37 +1,44 @@
build_command build_command
------------- -------------
Get the command line to build this project. Get a command line to build the current project.
This is mainly intended for internal use by the :module:`CTest` module.
:: .. code-block:: cmake
build_command(<variable> build_command(<variable>
[CONFIGURATION <config>] [CONFIGURATION <config>]
[PROJECT_NAME <projname>] [TARGET <target>]
[TARGET <target>]) [PROJECT_NAME <projname>] # legacy, causes warning
)
Sets the given <variable> to a string containing the command line for Sets the given ``<variable>`` to a command-line string of the form::
building one configuration of a target in a project using the build
tool appropriate for the current CMAKE_GENERATOR.
If CONFIGURATION is omitted, CMake chooses a reasonable default value <cmake> --build . [--config <config>] [--target <target>] [-- -i]
for multi-configuration generators. CONFIGURATION is ignored for
single-configuration generators.
If PROJECT_NAME is omitted, the resulting command line will build the where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line
top level PROJECT in the current build tree. tool, and ``<config>`` and ``<target>`` are the values provided to the
``CONFIGURATION`` and ``TARGET`` options, if any. The trailing ``-- -i``
option is added for Makefile generators.
If TARGET is omitted, the resulting command line will build When invoked, this ``cmake --build`` command line will launch the
everything, effectively using build target 'all' or 'ALL_BUILD'. underlying build system tool.
:: .. code-block:: cmake
build_command(<cachevariable> <makecommand>) build_command(<cachevariable> <makecommand>)
This second signature is deprecated, but still available for backwards This second signature is deprecated, but still available for backwards
compatibility. Use the first signature instead. compatibility. Use the first signature instead.
Sets the given <cachevariable> to a string containing the command to It sets the given ``<cachevariable>`` to a command-line string as
build this project from the root of the build tree using the build above but without the ``--config`` or ``--target`` options.
tool given by <makecommand>. <makecommand> should be the full path to The ``<makecommand>`` is ignored but should be the full path to
msdev, devenv, nmake, make or one of the end user build tools. msdev, devenv, nmake, make or one of the end user build tools
for legacy invocations.
.. note::
In CMake versions prior to 3.0 this command returned a command
line that directly invokes the native build tool for the current
generator. Their implementation of the ``PROJECT_NAME`` option
had no useful effects, so CMake now warns on use of the option.

View File

@ -225,8 +225,8 @@ Options
and or execute a test. The configure and test steps are optional. and or execute a test. The configure and test steps are optional.
The arguments to this command line are the source and binary The arguments to this command line are the source and binary
directories. By default this will run CMake on the Source/Bin directories. By default this will run CMake on the Source/Bin
directories specified unless --build-nocmake is specified. Both directories specified unless --build-nocmake is specified.
--build-makeprogram and --build-generator MUST be provided to use The --build-generator option *must* be provided to use
--build-and-test. If --test-command is specified then that will be --build-and-test. If --test-command is specified then that will be
run after the build is complete. Other options that affect this run after the build is complete. Other options that affect this
mode are --build-target --build-nocmake, --build-run-dir, mode are --build-target --build-nocmake, --build-run-dir,
@ -265,7 +265,7 @@ Options
Specify the name of the project to build. Specify the name of the project to build.
``--build-makeprogram`` ``--build-makeprogram``
Specify the make program to use. Override the make program chosen by CTest with a given one.
``--build-noclean`` ``--build-noclean``
Skip the make clean step. Skip the make clean step.

View File

@ -1,11 +1,6 @@
CMAKE_BUILD_TOOL CMAKE_BUILD_TOOL
---------------- ----------------
Tool used for the actual build process. This variable exists only for backwards compatibility.
It contains the same value as :variable:`CMAKE_MAKE_PROGRAM`.
This variable is set to the program that will be needed to build the Use that variable instead.
output of CMake. If the generator selected was Visual Studio 6, the
CMAKE_BUILD_TOOL will be set to msdev, for Unix Makefiles it will be
set to make or gmake, and for Visual Studio 7 it set to devenv. For
NMake Makefiles the value is nmake. This can be useful for adding
special flags and commands based on the final build environment.

View File

@ -1,7 +1,51 @@
CMAKE_MAKE_PROGRAM CMAKE_MAKE_PROGRAM
------------------ ------------------
See CMAKE_BUILD_TOOL. Tool that can launch the native build system.
The value may be the full path to an executable or just the tool
name if it is expected to be in the ``PATH``.
This variable is around for backwards compatibility, see The tool selected depends on the :variable:`CMAKE_GENERATOR` used
CMAKE_BUILD_TOOL. to configure the project:
* The Makefile generators set this to ``make``, ``gmake``, or
a generator-specific tool (e.g. ``nmake`` for "NMake Makefiles").
These generators store ``CMAKE_MAKE_PROGRAM`` in the CMake cache
so that it may be edited by the user.
* The Ninja generator sets this to ``ninja``.
This generator stores ``CMAKE_MAKE_PROGRAM`` in the CMake cache
so that it may be edited by the user.
* The Xcode generator sets this to ``xcodebuild`` (or possibly an
otherwise undocumented ``cmakexbuild`` wrapper implementing some
workarounds).
This generator stores ``CMAKE_MAKE_PROGRAM`` in the CMake cache
so that it may be edited by the user.
* The Visual Studio generators set this to the full path to
``MSBuild.exe`` (VS >= 10), ``devenv.com`` (VS 7,8,9),
``VCExpress.exe`` (VS Express 8,9), or ``msdev.exe`` (VS 6).
These generators prefer to lookup the build tool at build time
rather than to store ``CMAKE_MAKE_PROGRAM`` in the CMake cache
ahead of time. This is because the tools are version-specific
and can be located using the Windows Registry. It is also
necessary because the proper build tool may depend on the
project content (e.g. the Intel Fortran plugin to VS 10 and 11
requires ``devenv.com`` to build its ``.vfproj`` project files
even though ``MSBuild.exe`` is normally preferred to support
the :variable:`CMAKE_GENERATOR_TOOLSET`).
For compatibility with versions of CMake prior to 3.0, if
a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to
the CMake cache then CMake will use the specified value if
possible.
The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code.
The value is also used by the :manual:`cmake(1)` ``--build`` and
:manual:`ctest(1)` ``--build-and-test`` tools to launch the native
build process.

View File

@ -287,7 +287,6 @@ if(NOT CMAKE_CXX_LINK_EXECUTABLE)
endif() endif()
mark_as_advanced( mark_as_advanced(
CMAKE_BUILD_TOOL
CMAKE_VERBOSE_MAKEFILE CMAKE_VERBOSE_MAKEFILE
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE

View File

@ -94,12 +94,10 @@ set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS_INIT}" set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of static libraries.") CACHE STRING "Flags used by the linker during the creation of static libraries.")
set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL # Alias the build tool variable for backward compatibility.
"What is the target build tool cmake is generating for.") set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM})
mark_as_advanced( mark_as_advanced(
CMAKE_BUILD_TOOL
CMAKE_VERBOSE_MAKEFILE CMAKE_VERBOSE_MAKEFILE
CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS

View File

@ -1,54 +0,0 @@
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Look for devenv as a build program. We need to use this to support
# Intel Fortran integration into VS. MSBuild can not be used for that case
# since Intel Fortran uses the older devenv file format.
find_program(CMAKE_MAKE_PROGRAM
NAMES devenv
HINTS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;EnvironmentDirectory]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup;Dbghelp_path]
"$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio10.0/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio 10/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio10/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10.0/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10.0/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10/Common7/IDE"
"/Program Files/Microsoft Visual Studio 10.0/Common7/IDE/"
"/Program Files/Microsoft Visual Studio 10/Common7/IDE/"
)
# if devenv is not found, then use MSBuild.
# it is expected that if devenv is not found, then we are
# dealing with Visual Studio Express. VCExpress has random
# failures when being run as a command line build tool which
# causes the compiler checks and try-compile stuff to fail. MSbuild
# is a better choice for this. However, VCExpress does not support
# cross compiling needed for Win CE.
if(NOT CMAKE_CROSSCOMPILING)
find_program(CMAKE_MAKE_PROGRAM
NAMES MSBuild
HINTS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir]
"$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
"c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
"$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0;CLR Version]/")
endif()
mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC10 1)
set(MSVC_VERSION 1600)

View File

@ -1,53 +0,0 @@
#=============================================================================
# Copyright 2007-2011 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Look for devenv as a build program. We need to use this to support
# Intel Fortran integration into VS. MSBuild can not be used for that case
# since Intel Fortran uses the older devenv file format.
find_program(CMAKE_MAKE_PROGRAM
NAMES devenv
HINTS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;EnvironmentDirectory]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup;Dbghelp_path]
"$ENV{ProgramFiles}/Microsoft Visual Studio 11.0/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio11.0/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio 11/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio11/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 11.0/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio11.0/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 11/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio11/Common7/IDE"
"/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/"
"/Program Files/Microsoft Visual Studio 11/Common7/IDE/"
)
# if devenv is not found, then use MSBuild.
# it is expected that if devenv is not found, then we are
# dealing with Visual Studio Express.
if(NOT CMAKE_CROSSCOMPILING)
set(_FDIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkDir32]")
set(_FVER "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkVer32]")
find_program(CMAKE_MAKE_PROGRAM
NAMES MSBuild
HINTS
${_FDIR}/${_FVER}
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir]
"$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;CLR Version]/"
"c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;CLR Version]/"
"$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0;CLR Version]/")
endif()
mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC11 1)
set(MSVC_VERSION 1700)

View File

@ -1,27 +0,0 @@
#=============================================================================
# Copyright 2007-2013 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Always use MSBuild because:
# - devenv treats command-line builds as recently-loaded projects in the IDE
# - devenv does not appear to support non-standard platform toolsets
# If we need devenv for Intel Fortran in the future we should add
# a special case when Fortran is enabled.
find_program(CMAKE_MAKE_PROGRAM
NAMES MSBuild
HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\12.0;MSBuildToolsPath]"
)
mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC12 1)
set(MSVC_VERSION 1800)

View File

@ -1,25 +0,0 @@
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_program(CMAKE_MAKE_PROGRAM
NAMES msdev
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup;VsCommonDir]/MSDev98/Bin
"c:/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
"c:/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
"/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
)
mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC60 1)
set(MSVC_VERSION 1200)

View File

@ -1,26 +0,0 @@
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_program(CMAKE_MAKE_PROGRAM
NAMES devenv
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VS;EnvironmentDirectory]
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE"
"c:/Program Files/Microsoft Visual Studio .NET/Common7/IDE"
"c:/Program Files/Microsoft Visual Studio.NET/Common7/IDE"
"/Program Files/Microsoft Visual Studio .NET/Common7/IDE/"
)
mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC71 1)
set(MSVC_VERSION 1310)

View File

@ -1,25 +0,0 @@
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_program(CMAKE_MAKE_PROGRAM
NAMES devenv
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0\\Setup\\VS;EnvironmentDirectory]
"c:/Program Files/Microsoft Visual Studio .NET/Common7/IDE"
"c:/Program Files/Microsoft Visual Studio.NET/Common7/IDE"
"/Program Files/Microsoft Visual Studio .NET/Common7/IDE/"
)
mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC70 1)
set(MSVC_VERSION 1300)

View File

@ -1,34 +0,0 @@
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# VCExpress does not support cross compiling, which is necessary for Win CE
set( _CMAKE_MAKE_PROGRAM_NAMES devenv)
if(NOT CMAKE_CROSSCOMPILING)
set( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress)
endif()
find_program(CMAKE_MAKE_PROGRAM
NAMES ${_CMAKE_MAKE_PROGRAM_NAMES}
HINTS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VS;EnvironmentDirectory]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]
"$ENV{ProgramFiles}/Microsoft Visual Studio 8/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio8/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/Common7/IDE"
"/Program Files/Microsoft Visual Studio 8/Common7/IDE/"
)
mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC80 1)
set(MSVC_VERSION 1400)

View File

@ -1,39 +0,0 @@
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# VCExpress does not support cross compiling, which is necessary for Win CE
set( _CMAKE_MAKE_PROGRAM_NAMES devenv)
if(NOT CMAKE_CROSSCOMPILING)
set( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress)
endif()
find_program(CMAKE_MAKE_PROGRAM
NAMES ${_CMAKE_MAKE_PROGRAM_NAMES}
HINTS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VS;EnvironmentDirectory]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup;Dbghelp_path]
"$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio9.0/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio 9/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio9/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9.0/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/Common7/IDE"
"/Program Files/Microsoft Visual Studio 9.0/Common7/IDE/"
"/Program Files/Microsoft Visual Studio 9/Common7/IDE/"
)
mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC90 1)
set(MSVC_VERSION 1500)

View File

@ -244,7 +244,7 @@ if(BUILD_TESTING)
"${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT}) "${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT})
else() else()
get_filename_component(DART_CXX_NAME get_filename_component(DART_CXX_NAME
"${CMAKE_BUILD_TOOL}" ${DART_NAME_COMPONENT}) "${CMAKE_MAKE_PROGRAM}" ${DART_NAME_COMPONENT})
endif() endif()
if(DART_CXX_NAME MATCHES "msdev") if(DART_CXX_NAME MATCHES "msdev")
set(DART_CXX_NAME "vs60") set(DART_CXX_NAME "vs60")

View File

@ -637,19 +637,21 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
globalGenerator->FindMakeProgram(this->MakefileMap); globalGenerator->FindMakeProgram(this->MakefileMap);
const char* cmakeMakeProgram const char* cmakeMakeProgram
= this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM"); = this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM");
std::string buildCommand std::vector<std::string> buildCommand;
= globalGenerator->GenerateBuildCommand(cmakeMakeProgram, globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram,
installProjectName.c_str(), 0, 0, installProjectName.c_str(), installDirectory.c_str(),
globalGenerator->GetPreinstallTargetName(), globalGenerator->GetPreinstallTargetName(),
buildConfig, false, false); buildConfig, false);
std::string buildCommandStr =
cmSystemTools::PrintSingleCommand(buildCommand);
cmCPackLogger(cmCPackLog::LOG_DEBUG, cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Install command: " << buildCommand << std::endl); "- Install command: " << buildCommandStr << std::endl);
cmCPackLogger(cmCPackLog::LOG_OUTPUT, cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Run preinstall target for: " << installProjectName << std::endl); "- Run preinstall target for: " << installProjectName << std::endl);
std::string output; std::string output;
int retVal = 1; int retVal = 1;
bool resB = bool resB =
cmSystemTools::RunSingleCommand(buildCommand.c_str(), cmSystemTools::RunSingleCommand(buildCommand,
&output, &output,
&retVal, &retVal,
installDirectory.c_str(), installDirectory.c_str(),
@ -659,12 +661,12 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/PreinstallOutput.log"; tmpFile += "/PreinstallOutput.log";
cmGeneratedFileStream ofs(tmpFile.c_str()); cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << buildCommand.c_str() << std::endl ofs << "# Run command: " << buildCommandStr.c_str() << std::endl
<< "# Directory: " << installDirectory.c_str() << std::endl << "# Directory: " << installDirectory.c_str() << std::endl
<< "# Output:" << std::endl << "# Output:" << std::endl
<< output.c_str() << std::endl; << output.c_str() << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem running install command: " << buildCommand.c_str() "Problem running install command: " << buildCommandStr.c_str()
<< std::endl << std::endl
<< "Please check " << tmpFile.c_str() << " for errors" << "Please check " << tmpFile.c_str() << " for errors"
<< std::endl); << std::endl);

View File

@ -18,6 +18,7 @@
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include <cmsys/Process.h> #include <cmsys/Process.h>
#include "cmCTestTestHandler.h" #include "cmCTestTestHandler.h"
#include "cmCacheManager.h"
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
@ -184,14 +185,14 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
cmOStringStream out; cmOStringStream out;
// if the generator and make program are not specified then it is an error // if the generator and make program are not specified then it is an error
if (!this->BuildGenerator.size() || !this->BuildMakeProgram.size()) if (!this->BuildGenerator.size())
{ {
if(outstring) if(outstring)
{ {
*outstring = *outstring =
"--build-and-test requires that both the generator and makeprogram " "--build-and-test requires that the generator "
"be provided using the --build-generator and --build-makeprogram " "be provided using the --build-generator "
"command line options. "; "command line option. ";
} }
return 1; return 1;
} }
@ -238,9 +239,13 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
if(this->BuildNoCMake) if(this->BuildNoCMake)
{ {
// Make the generator available for the Build call below.
cm.SetGlobalGenerator(cm.CreateGlobalGenerator( cm.SetGlobalGenerator(cm.CreateGlobalGenerator(
this->BuildGenerator.c_str())); this->BuildGenerator.c_str()));
cm.SetGeneratorToolset(this->BuildGeneratorToolset); cm.SetGeneratorToolset(this->BuildGeneratorToolset);
// Load the cache to make CMAKE_MAKE_PROGRAM available.
cm.GetCacheManager()->LoadCache(this->BinaryDir.c_str());
} }
else else
{ {
@ -508,23 +513,14 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
{ {
this->BuildNoClean = true; this->BuildNoClean = true;
} }
if(currentArg.find("--build-options",0) == 0 && idx < allArgs.size() - 1) if(currentArg.find("--build-options",0) == 0)
{ {
++idx; while(idx+1 < allArgs.size() &&
bool done = false; allArgs[idx+1] != "--build-target" &&
while(idx < allArgs.size() && !done) allArgs[idx+1] != "--test-command")
{ {
++idx;
this->BuildOptions.push_back(allArgs[idx]); this->BuildOptions.push_back(allArgs[idx]);
if(idx+1 < allArgs.size()
&& (allArgs[idx+1] == "--build-target" ||
allArgs[idx+1] == "--test-command"))
{
done = true;
}
else
{
++idx;
}
} }
} }
if(currentArg.find("--test-command",0) == 0 && idx < allArgs.size() - 1) if(currentArg.find("--test-command",0) == 0 && idx < allArgs.size() - 1)

View File

@ -114,9 +114,6 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
this->Makefile->GetCMakeInstance()->CreateGlobalGenerator( this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGeneratorName); cmakeGeneratorName);
} }
this->GlobalGenerator->FindMakeProgram(this->Makefile);
const char* cmakeMakeProgram
= this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
if(strlen(cmakeBuildConfiguration) == 0) if(strlen(cmakeBuildConfiguration) == 0)
{ {
const char* config = 0; const char* config = 0;
@ -133,10 +130,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory"); std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
std::string buildCommand std::string buildCommand
= this->GlobalGenerator-> = this->GlobalGenerator->
GenerateBuildCommand(cmakeMakeProgram, GenerateCMakeBuildCommand(cmakeBuildTarget, cmakeBuildConfiguration,
cmakeProjectName, dir.c_str(), cmakeBuildAdditionalFlags, true);
cmakeBuildAdditionalFlags, cmakeBuildTarget,
cmakeBuildConfiguration, true, false);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:" "SetMakeCommand:"
<< buildCommand.c_str() << "\n"); << buildCommand.c_str() << "\n");

View File

@ -85,18 +85,7 @@ bool cmBuildCommand
} }
} }
const char* makeprogram // If null/empty CONFIGURATION argument, cmake --build uses 'Debug'
= this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
if(!makeprogram)
{
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
"build_command() requires CMAKE_MAKE_PROGRAM to be defined. "
"Call project() or enable_language() first.");
return true;
}
// If null/empty CONFIGURATION argument, GenerateBuildCommand uses 'Debug'
// in the currently implemented multi-configuration global generators... // in the currently implemented multi-configuration global generators...
// so we put this code here to end up with the same default configuration // so we put this code here to end up with the same default configuration
// as the original 2-arg build_command signature: // as the original 2-arg build_command signature:
@ -110,19 +99,15 @@ bool cmBuildCommand
configuration = "Release"; configuration = "Release";
} }
// If null/empty PROJECT_NAME argument, use the Makefile's project name: if(project_name && *project_name)
//
if(!project_name || !*project_name)
{ {
project_name = this->Makefile->GetProjectName(); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
"Ignoring PROJECT_NAME option because it has no effect.");
} }
// If null/empty TARGET argument, GenerateBuildCommand omits any mention
// of a target name on the build command line...
//
std::string makecommand = this->Makefile->GetLocalGenerator() std::string makecommand = this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()->GenerateBuildCommand ->GetGlobalGenerator()->GenerateCMakeBuildCommand(target, configuration,
(makeprogram, project_name, 0, 0, target, configuration, true, false); 0, true);
this->Makefile->AddDefinition(variable, makecommand.c_str()); this->Makefile->AddDefinition(variable, makecommand.c_str());
@ -142,7 +127,6 @@ bool cmBuildCommand
const char* define = args[0].c_str(); const char* define = args[0].c_str();
const char* cacheValue const char* cacheValue
= this->Makefile->GetDefinition(define); = this->Makefile->GetDefinition(define);
std::string makeprogram = args[1];
std::string configType = "Release"; std::string configType = "Release";
const char* cfg = getenv("CMAKE_CONFIG_TYPE"); const char* cfg = getenv("CMAKE_CONFIG_TYPE");
@ -152,9 +136,8 @@ bool cmBuildCommand
} }
std::string makecommand = this->Makefile->GetLocalGenerator() std::string makecommand = this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()->GenerateBuildCommand ->GetGlobalGenerator()->GenerateCMakeBuildCommand(0, configType.c_str(),
(makeprogram.c_str(), this->Makefile->GetProjectName(), 0, 0, 0, true);
0, configType.c_str(), true, false);
if(cacheValue) if(cacheValue)
{ {

View File

@ -88,6 +88,26 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts)
return false; return false;
} }
std::string cmGlobalGenerator::SelectMakeProgram(const char* makeProgram,
std::string makeDefault)
{
if(cmSystemTools::IsOff(makeProgram))
{
makeProgram =
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
if(cmSystemTools::IsOff(makeProgram))
{
makeProgram = makeDefault.c_str();
}
if(cmSystemTools::IsOff(makeProgram) &&
!(makeProgram && *makeProgram))
{
makeProgram = "CMAKE_MAKE_PROGRAM-NOTFOUND";
}
}
return makeProgram;
}
void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
cmMakefile *mf, cmMakefile *mf,
bool optional) bool optional)
@ -1542,15 +1562,6 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
this->FirstTimeProgress); this->FirstTimeProgress);
} }
std::string makeCommand = this->CMakeInstance->
GetCacheManager()->GetCacheValue("CMAKE_MAKE_PROGRAM");
if(makeCommand.size() == 0)
{
cmSystemTools::Error(
"Generator cannot find the appropriate make command.");
return 1;
}
std::string newTarget; std::string newTarget;
if (target && strlen(target)) if (target && strlen(target))
{ {
@ -1570,45 +1581,16 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
return this->Build(srcdir,bindir,projectName, return this->Build(srcdir,bindir,projectName,
newTarget.c_str(), newTarget.c_str(),
output,makeCommand.c_str(),config,false,fast, output,0,config,false,fast,
this->TryCompileTimeout); this->TryCompileTimeout);
} }
std::string cmGlobalGenerator void cmGlobalGenerator::GenerateBuildCommand(
::GenerateBuildCommand(const char* makeProgram, const char *projectName, std::vector<std::string>& makeCommand, const char*, const char*, const char*,
const char *projectDir, const char* additionalOptions, const char*, const char*, bool, std::vector<std::string> const&)
const char *targetName, const char* config,
bool ignoreErrors, bool)
{ {
// Project name & dir and config are not used yet. makeCommand.push_back(
(void)projectName; "cmGlobalGenerator::GenerateBuildCommand not implemented");
(void)projectDir;
(void)config;
std::string makeCommand =
cmSystemTools::ConvertToUnixOutputPath(makeProgram);
// Since we have full control over the invocation of nmake, let us
// make it quiet.
if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
{
makeCommand += " /NOLOGO ";
}
if ( ignoreErrors )
{
makeCommand += " -i";
}
if ( additionalOptions )
{
makeCommand += " ";
makeCommand += additionalOptions;
}
if ( targetName )
{
makeCommand += " ";
makeCommand += targetName;
}
return makeCommand;
} }
int cmGlobalGenerator::Build( int cmGlobalGenerator::Build(
@ -1620,7 +1602,6 @@ int cmGlobalGenerator::Build(
bool clean, bool fast, bool clean, bool fast,
double timeout, double timeout,
cmSystemTools::OutputOption outputflag, cmSystemTools::OutputOption outputflag,
const char* extraOptions,
std::vector<std::string> const& nativeOptions) std::vector<std::string> const& nativeOptions)
{ {
/** /**
@ -1648,17 +1629,17 @@ int cmGlobalGenerator::Build(
// should we do a clean first? // should we do a clean first?
if (clean) if (clean)
{ {
std::string cleanCommand = std::vector<std::string> cleanCommand;
this->GenerateBuildCommand(makeCommandCSTR, projectName, bindir, this->GenerateBuildCommand(cleanCommand, makeCommandCSTR, projectName,
0, "clean", config, false, fast); bindir, "clean", config, fast);
if(output) if(output)
{ {
*output += "\nRun Clean Command:"; *output += "\nRun Clean Command:";
*output += cleanCommand; *output += cmSystemTools::PrintSingleCommand(cleanCommand);
*output += "\n"; *output += "\n";
} }
if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), outputPtr, if (!cmSystemTools::RunSingleCommand(cleanCommand, outputPtr,
&retVal, 0, outputflag, timeout)) &retVal, 0, outputflag, timeout))
{ {
cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::SetRunCommandHideConsole(hideconsole);
@ -1680,37 +1661,29 @@ int cmGlobalGenerator::Build(
} }
// now build // now build
std::string makeCommand = std::vector<std::string> makeCommand;
this->GenerateBuildCommand(makeCommandCSTR, projectName, bindir, this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName,
extraOptions, target, bindir, target, config, fast, nativeOptions);
config, false, fast); std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand);
if(output) if(output)
{ {
*output += "\nRun Build Command:"; *output += "\nRun Build Command:";
*output += makeCommand; *output += makeCommandStr;
*output += "\n"; *output += "\n";
} }
std::vector<cmStdString> command = if (!cmSystemTools::RunSingleCommand(makeCommand, outputPtr,
cmSystemTools::ParseArguments(makeCommand.c_str());
for(std::vector<std::string>::const_iterator ni = nativeOptions.begin();
ni != nativeOptions.end(); ++ni)
{
command.push_back(*ni);
}
if (!cmSystemTools::RunSingleCommand(command, outputPtr,
&retVal, 0, outputflag, timeout)) &retVal, 0, outputflag, timeout))
{ {
cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error cmSystemTools::Error
("Generator: execution of make failed. Make command was: ", ("Generator: execution of make failed. Make command was: ",
makeCommand.c_str()); makeCommandStr.c_str());
if (output) if (output)
{ {
*output += *outputPtr; *output += *outputPtr;
*output += "\nGenerator: execution of make failed. Make command was: " *output += "\nGenerator: execution of make failed. Make command was: "
+ makeCommand + "\n"; + makeCommandStr + "\n";
} }
// return to the original directory // return to the original directory
@ -1735,6 +1708,46 @@ int cmGlobalGenerator::Build(
return retVal; return retVal;
} }
//----------------------------------------------------------------------------
std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
const char* target, const char* config, const char* native,
bool ignoreErrors)
{
std::string makeCommand = cmSystemTools::GetCMakeCommand();
makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
makeCommand += " --build .";
if(config && *config)
{
makeCommand += " --config \"";
makeCommand += config;
makeCommand += "\"";
}
if(target && *target)
{
makeCommand += " --target \"";
makeCommand += target;
makeCommand += "\"";
}
const char* sep = " -- ";
if(ignoreErrors)
{
const char* iflag = this->GetBuildIgnoreErrorsFlag();
if(iflag && *iflag)
{
makeCommand += sep;
makeCommand += iflag;
sep = " ";
}
}
if(native && *native)
{
makeCommand += sep;
makeCommand += native;
}
return makeCommand;
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
{ {
this->LocalGenerators.push_back(lg); this->LocalGenerators.push_back(lg);

View File

@ -123,17 +123,22 @@ public:
bool clean, bool fast, bool clean, bool fast,
double timeout, double timeout,
cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE, cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE,
const char* extraOptions = 0,
std::vector<std::string> const& nativeOptions = std::vector<std::string> const& nativeOptions =
std::vector<std::string>()); std::vector<std::string>());
virtual std::string GenerateBuildCommand( virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const char *projectName, const char *projectDir, const char *projectName, const char *projectDir,
const char* additionalOptions, const char *targetName, const char* config, bool fast,
const char *targetName, const char* config, std::vector<std::string> const& makeOptions = std::vector<std::string>()
bool ignoreErrors, bool fast); );
/** Generate a "cmake --build" call for a given target and config. */
std::string GenerateCMakeBuildCommand(const char* target,
const char* config,
const char* native,
bool ignoreErrors);
///! Set the CMake instance ///! Set the CMake instance
void SetCMakeInstance(cmake *cm); void SetCMakeInstance(cmake *cm);
@ -198,7 +203,7 @@ public:
/* /*
* Determine what program to use for building the project. * Determine what program to use for building the project.
*/ */
void FindMakeProgram(cmMakefile*); virtual void FindMakeProgram(cmMakefile*);
///! Find a target by name by searching the local generators. ///! Find a target by name by searching the local generators.
cmTarget* FindTarget(const char* project, const char* name, cmTarget* FindTarget(const char* project, const char* name,
@ -331,6 +336,8 @@ protected:
typedef std::vector<std::pair<cmQtAutoGenerators, cmTarget*> > AutogensType; typedef std::vector<std::pair<cmQtAutoGenerators, cmTarget*> > AutogensType;
void CreateQtAutoGeneratorsTargets(AutogensType& autogens); void CreateQtAutoGeneratorsTargets(AutogensType& autogens);
std::string SelectMakeProgram(const char* makeProgram,
std::string makeDefault = "");
// Fill the ProjectMap, this must be called after LocalGenerators // Fill the ProjectMap, this must be called after LocalGenerators
// has been populated. // has been populated.
@ -424,6 +431,8 @@ private:
void ClearGeneratorMembers(); void ClearGeneratorMembers();
virtual const char* GetBuildIgnoreErrorsFlag() const { return 0; }
// Cache directory content and target files to be built. // Cache directory content and target files to be built.
struct DirectoryContent: public std::set<cmStdString> struct DirectoryContent: public std::set<cmStdString>
{ {

View File

@ -462,7 +462,7 @@ void cmGlobalKdevelopGenerator
" <numberofjobs>1</numberofjobs>\n" " <numberofjobs>1</numberofjobs>\n"
" <dontact>false</dontact>\n" " <dontact>false</dontact>\n"
" <makebin>" << this->GlobalGenerator->GetLocalGenerators()[0]-> " <makebin>" << this->GlobalGenerator->GetLocalGenerators()[0]->
GetMakefile()->GetRequiredDefinition("CMAKE_BUILD_TOOL") GetMakefile()->GetRequiredDefinition("CMAKE_MAKE_PROGRAM")
<< " </makebin>\n" << " </makebin>\n"
" <selectedenvironment>default</selectedenvironment>\n" " <selectedenvironment>default</selectedenvironment>\n"
" <environments>\n" " <environments>\n"

View File

@ -549,47 +549,34 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false;
// cmGlobalXCodeGenerator // cmGlobalXCodeGenerator
// Called by: // Called by:
// cmGlobalGenerator::Build() // cmGlobalGenerator::Build()
std::string cmGlobalNinjaGenerator void cmGlobalNinjaGenerator
::GenerateBuildCommand(const char* makeProgram, ::GenerateBuildCommand(std::vector<std::string>& makeCommand,
const char* projectName, const char* makeProgram,
const char* projectDir, const char* /*projectName*/,
const char* additionalOptions, const char* /*projectDir*/,
const char* targetName, const char* targetName,
const char* config, const char* /*config*/,
bool ignoreErrors, bool /*fast*/,
bool fast) std::vector<std::string> const& makeOptions)
{ {
// Project name & dir and config are not used yet. makeCommand.push_back(
(void)projectName; this->SelectMakeProgram(makeProgram)
(void)projectDir; );
(void)config;
// Ninja does not have -i equivalent option yet.
(void)ignoreErrors;
// We do not handle fast build yet.
(void)fast;
std::string makeCommand = makeCommand.insert(makeCommand.end(),
cmSystemTools::ConvertToUnixOutputPath(makeProgram); makeOptions.begin(), makeOptions.end());
if(targetName && *targetName)
if(additionalOptions)
{
makeCommand += " ";
makeCommand += additionalOptions;
}
if(targetName)
{ {
if(strcmp(targetName, "clean") == 0) if(strcmp(targetName, "clean") == 0)
{ {
makeCommand += " -t clean"; makeCommand.push_back("-t");
makeCommand.push_back("clean");
} }
else else
{ {
makeCommand += " "; makeCommand.push_back(targetName);
makeCommand += targetName;
} }
} }
return makeCommand;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -191,14 +191,16 @@ public:
bool optional); bool optional);
/// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand() /// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand()
virtual std::string GenerateBuildCommand(const char* makeProgram, virtual void GenerateBuildCommand(
const char* projectName, std::vector<std::string>& makeCommand,
const char* projectDir, const char* makeProgram,
const char* additionalOptions, const char* projectName,
const char* targetName, const char* projectDir,
const char* config, const char* targetName,
bool ignoreErrors, const char* config,
bool fast); bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
// Setup target names // Setup target names
virtual const char* GetAllTargetName() const { return "all"; } virtual const char* GetAllTargetName() const { return "all"; }

View File

@ -555,36 +555,29 @@ cmGlobalUnixMakefileGenerator3
this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true); this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true);
} }
//----------------------------------------------------------------------------
std::string cmGlobalUnixMakefileGenerator3 void cmGlobalUnixMakefileGenerator3
::GenerateBuildCommand(const char* makeProgram, const char *projectName, ::GenerateBuildCommand(std::vector<std::string>& makeCommand,
const char *projectDir, const char* additionalOptions, const char* makeProgram,
const char *targetName, const char* config, const char* /*projectName*/,
bool ignoreErrors, bool fast) const char* /*projectDir*/,
const char* targetName,
const char* /*config*/,
bool fast,
std::vector<std::string> const& makeOptions)
{ {
// Project name & dir and config are not used yet. makeCommand.push_back(
(void)projectName; this->SelectMakeProgram(makeProgram)
(void)projectDir; );
(void)config;
std::string makeCommand =
cmSystemTools::ConvertToUnixOutputPath(makeProgram);
// Since we have full control over the invocation of nmake, let us // Since we have full control over the invocation of nmake, let us
// make it quiet. // make it quiet.
if ( strcmp(this->GetName(), "NMake Makefiles") == 0 ) if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
{ {
makeCommand += " /NOLOGO "; makeCommand.push_back("/NOLOGO");
}
if ( ignoreErrors )
{
makeCommand += " -i";
}
if ( additionalOptions )
{
makeCommand += " ";
makeCommand += additionalOptions;
} }
makeCommand.insert(makeCommand.end(),
makeOptions.begin(), makeOptions.end());
if ( targetName && strlen(targetName)) if ( targetName && strlen(targetName))
{ {
cmLocalUnixMakefileGenerator3 *lg; cmLocalUnixMakefileGenerator3 *lg;
@ -605,22 +598,19 @@ std::string cmGlobalUnixMakefileGenerator3
lg->GetMakefile()->MakeStartDirectoriesCurrent(); lg->GetMakefile()->MakeStartDirectoriesCurrent();
} }
makeCommand += " \"";
std::string tname = targetName; std::string tname = targetName;
if(fast) if(fast)
{ {
tname += "/fast"; tname += "/fast";
} }
tname = lg->Convert(tname.c_str(),cmLocalGenerator::HOME_OUTPUT, tname = lg->Convert(tname.c_str(),cmLocalGenerator::HOME_OUTPUT);
cmLocalGenerator::MAKEFILE); cmSystemTools::ConvertToOutputSlashes(tname);
makeCommand += tname.c_str(); makeCommand.push_back(tname);
makeCommand += "\"";
if (!this->LocalGenerators.size()) if (!this->LocalGenerators.size())
{ {
delete lg; delete lg;
} }
} }
return makeCommand;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -107,12 +107,16 @@ public:
std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; } std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; }
// change the build command for speed // change the build command for speed
virtual std::string GenerateBuildCommand virtual void GenerateBuildCommand(
(const char* makeProgram, std::vector<std::string>& makeCommand,
const char *projectName, const char *projectDir, const char* makeProgram,
const char* additionalOptions, const char* projectName,
const char *targetName, const char* projectDir,
const char* config, bool ignoreErrors, bool fast); const char* targetName,
const char* config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/** Record per-target progress information. */ /** Record per-target progress information. */
void RecordTargetProgress(cmMakefileTargetGenerator* tg); void RecordTargetProgress(cmMakefileTargetGenerator* tg);
@ -188,6 +192,7 @@ protected:
cmGeneratedFileStream *CommandDatabase; cmGeneratedFileStream *CommandDatabase;
private: private:
virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; }
virtual std::string GetEditCacheCommand() const; virtual std::string GetEditCacheCommand() const;
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
}; };

View File

@ -92,12 +92,12 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
: cmGlobalVisualStudio8Generator(name, platformName, : cmGlobalVisualStudio8Generator(name, platformName,
additionalPlatformDefinition) additionalPlatformDefinition)
{ {
this->FindMakeProgramFile = "CMakeVS10FindMake.cmake";
std::string vc10Express; std::string vc10Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;"
"ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
this->MasmEnabled = false; this->MasmEnabled = false;
this->MSBuildCommandInitialized = false;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -255,50 +255,121 @@ std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase()
return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros"; return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros";
} }
//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio10Generator std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand()
::GenerateBuildCommand(const char* makeProgram,
const char *projectName, const char *projectDir,
const char* additionalOptions, const char *targetName,
const char* config, bool ignoreErrors, bool fast)
{ {
// now build the test if(!this->MSBuildCommandInitialized)
std::string makeCommand
= cmSystemTools::ConvertToOutputPath(makeProgram);
std::string lowerCaseCommand = makeCommand;
cmSystemTools::LowerCase(lowerCaseCommand);
// If makeProgram is devenv, parent class knows how to generate command:
if (lowerCaseCommand.find("devenv") != std::string::npos ||
lowerCaseCommand.find("VCExpress") != std::string::npos)
{ {
return cmGlobalVisualStudio7Generator::GenerateBuildCommand(makeProgram, this->MSBuildCommandInitialized = true;
projectName, projectDir, additionalOptions, targetName, config, this->MSBuildCommand = this->FindMSBuildCommand();
ignoreErrors, fast); }
return this->MSBuildCommand;
}
//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand()
{
std::string msbuild;
std::string mskey =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\";
mskey += this->GetToolsVersion();
mskey += ";MSBuildToolsPath";
if(cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild,
cmSystemTools::KeyWOW64_32))
{
cmSystemTools::ConvertToUnixSlashes(msbuild);
msbuild += "/";
}
msbuild += "MSBuild.exe";
return msbuild;
}
//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand()
{
if(this->ExpressEdition)
{
// Visual Studio Express >= 10 do not have "devenv.com" or
// "VCExpress.exe" that we can use to build reliably.
// Tell the caller it needs to use MSBuild instead.
return "";
}
// Skip over the cmGlobalVisualStudio8Generator implementation because
// we expect a real devenv and do not want to look for VCExpress.
return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand();
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
const char* projectName,
const char* projectDir,
const char* targetName,
const char* config,
bool fast,
std::vector<std::string> const& makeOptions)
{
// Select the caller- or user-preferred make program, else MSBuild.
std::string makeProgramSelected =
this->SelectMakeProgram(makeProgram, this->GetMSBuildCommand());
// Check if the caller explicitly requested a devenv tool.
std::string makeProgramLower = makeProgramSelected;
cmSystemTools::LowerCase(makeProgramLower);
bool useDevEnv =
(makeProgramLower.find("devenv") != std::string::npos ||
makeProgramLower.find("vcexpress") != std::string::npos);
// MSBuild is preferred (and required for VS Express), but if the .sln has
// an Intel Fortran .vfproj then we have to use devenv. Parse it to find out.
cmSlnData slnData;
{
std::string slnFile;
if(projectDir && *projectDir)
{
slnFile = projectDir;
slnFile += "/";
}
slnFile += projectName;
slnFile += ".sln";
cmVisualStudioSlnParser parser;
if(parser.ParseFile(slnFile, slnData,
cmVisualStudioSlnParser::DataGroupProjects))
{
std::vector<cmSlnProjectEntry> slnProjects = slnData.GetProjects();
for(std::vector<cmSlnProjectEntry>::iterator i = slnProjects.begin();
!useDevEnv && i != slnProjects.end(); ++i)
{
std::string proj = i->GetRelativePath();
if(proj.size() > 7 &&
proj.substr(proj.size()-7) == ".vfproj")
{
useDevEnv = true;
}
}
}
}
if(useDevEnv)
{
// Use devenv to build solutions containing Intel Fortran projects.
cmGlobalVisualStudio7Generator::GenerateBuildCommand(
makeCommand, makeProgram, projectName, projectDir,
targetName, config, fast, makeOptions);
return;
} }
// Otherwise, assume MSBuild command line, and construct accordingly. makeCommand.push_back(makeProgramSelected);
// if there are spaces in the makeCommand, assume a full path
// and convert it to a path with no spaces in it as the
// RunSingleCommand does not like spaces
if(makeCommand.find(' ') != std::string::npos)
{
cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand);
}
// msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD // msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD
if(!targetName || strlen(targetName) == 0) if(!targetName || strlen(targetName) == 0)
{ {
targetName = "ALL_BUILD"; targetName = "ALL_BUILD";
} }
bool clean = false;
if ( targetName && strcmp(targetName, "clean") == 0 ) if ( targetName && strcmp(targetName, "clean") == 0 )
{ {
clean = true; makeCommand.push_back(std::string(projectName)+".sln");
makeCommand += " "; makeCommand.push_back("/t:Clean");
makeCommand += projectName;
makeCommand += ".sln ";
makeCommand += "/t:Clean ";
} }
else else
{ {
@ -307,51 +378,29 @@ std::string cmGlobalVisualStudio10Generator
if (targetProject.find('/') == std::string::npos) if (targetProject.find('/') == std::string::npos)
{ {
// it might be in a subdir // it might be in a subdir
cmVisualStudioSlnParser parser; if (cmSlnProjectEntry const* proj =
cmSlnData slnData; slnData.GetProjectByName(targetName))
std::string slnFile;
if (projectDir && *projectDir)
{ {
slnFile = projectDir; targetProject = proj->GetRelativePath();
slnFile += '/'; cmSystemTools::ConvertToUnixSlashes(targetProject);
slnFile += projectName;
}
else
{
slnFile = projectName;
}
if (parser.ParseFile(slnFile + ".sln", slnData,
cmVisualStudioSlnParser::DataGroupProjects))
{
if (cmSlnProjectEntry const* proj =
slnData.GetProjectByName(targetName))
{
targetProject = proj->GetRelativePath();
cmSystemTools::ConvertToUnixSlashes(targetProject);
}
} }
} }
makeCommand += " "; makeCommand.push_back(targetProject);
makeCommand += targetProject;
makeCommand += " ";
} }
makeCommand += "/p:Configuration="; std::string configArg = "/p:Configuration=";
if(config && strlen(config)) if(config && strlen(config))
{ {
makeCommand += config; configArg += config;
} }
else else
{ {
makeCommand += "Debug"; configArg += "Debug";
} }
makeCommand += " /p:VisualStudioVersion="; makeCommand.push_back(configArg);
makeCommand += this->GetIDEVersion(); makeCommand.push_back(std::string("/p:VisualStudioVersion=")+
if ( additionalOptions ) this->GetIDEVersion());
{ makeCommand.insert(makeCommand.end(),
makeCommand += " "; makeOptions.begin(), makeOptions.end());
makeCommand += additionalOptions;
}
return makeCommand;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -32,11 +32,16 @@ public:
virtual bool SetGeneratorToolset(std::string const& ts); virtual bool SetGeneratorToolset(std::string const& ts);
virtual std::string virtual void GenerateBuildCommand(
GenerateBuildCommand(const char* makeProgram, std::vector<std::string>& makeCommand,
const char *projectName, const char *projectDir, const char* makeProgram,
const char* additionalOptions, const char *targetName, const char* projectName,
const char* config, bool ignoreErrors, bool); const char* projectDir,
const char* targetName,
const char* config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void AddPlatformDefinitions(cmMakefile* mf);
@ -89,6 +94,8 @@ public:
protected: protected:
virtual const char* GetIDEVersion() { return "10.0"; } virtual const char* GetIDEVersion() { return "10.0"; }
std::string const& GetMSBuildCommand();
std::string PlatformToolset; std::string PlatformToolset;
bool ExpressEdition; bool ExpressEdition;
bool MasmEnabled; bool MasmEnabled;
@ -106,5 +113,11 @@ private:
std::string SourceRel; std::string SourceRel;
}; };
LongestSourcePath LongestSource; LongestSourcePath LongestSource;
std::string MSBuildCommand;
bool MSBuildCommandInitialized;
virtual std::string FindMSBuildCommand();
virtual std::string FindDevEnvCommand();
virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
}; };
#endif #endif

View File

@ -112,7 +112,6 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
: cmGlobalVisualStudio10Generator(name, platformName, : cmGlobalVisualStudio10Generator(name, platformName,
additionalPlatformDefinition) additionalPlatformDefinition)
{ {
this->FindMakeProgramFile = "CMakeVS11FindMake.cmake";
std::string vc11Express; std::string vc11Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;" "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;"

View File

@ -87,7 +87,6 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
: cmGlobalVisualStudio11Generator(name, platformName, : cmGlobalVisualStudio11Generator(name, platformName,
additionalPlatformDefinition) additionalPlatformDefinition)
{ {
this->FindMakeProgramFile = "CMakeVS12FindMake.cmake";
std::string vc12Express; std::string vc12Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;" "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;"

View File

@ -32,7 +32,7 @@ std::string GetVS6TargetName(const std::string& targetName)
cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator()
{ {
this->FindMakeProgramFile = "CMakeVS6FindMake.cmake"; this->MSDevCommandInitialized = false;
} }
void cmGlobalVisualStudio6Generator void cmGlobalVisualStudio6Generator
@ -77,52 +77,53 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
} }
} }
std::string cmGlobalVisualStudio6Generator //----------------------------------------------------------------------------
::GenerateBuildCommand(const char* makeProgram, std::string const& cmGlobalVisualStudio6Generator::GetMSDevCommand()
const char *projectName,
const char *projectDir,
const char* additionalOptions,
const char *targetName,
const char* config,
bool ignoreErrors,
bool)
{ {
// Visual studio 6 doesn't need project dir if(!this->MSDevCommandInitialized)
(void) projectDir; {
// Ingoring errors is not implemented in visual studio 6 this->MSDevCommandInitialized = true;
(void) ignoreErrors; this->MSDevCommand = this->FindMSDevCommand();
}
return this->MSDevCommand;
}
//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio6Generator::FindMSDevCommand()
{
std::string vscmd;
std::string vskey = this->GetRegistryBase() + "\\Setup;VsCommonDir";
if(cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd,
cmSystemTools::KeyWOW64_32))
{
cmSystemTools::ConvertToUnixSlashes(vscmd);
vscmd += "/MSDev98/Bin/";
}
vscmd += "msdev.exe";
return vscmd;
}
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio6Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
const char* projectName,
const char* /*projectDir*/,
const char* targetName,
const char* config,
bool /*fast*/,
std::vector<std::string> const& makeOptions
)
{
// now build the test // now build the test
std::vector<std::string> mp; makeCommand.push_back(
mp.push_back("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio" this->SelectMakeProgram(makeProgram, this->GetMSDevCommand())
"\\6.0\\Setup;VsCommonDir]/MSDev98/Bin"); );
cmSystemTools::ExpandRegistryValues(mp[0]);
std::string originalCommand = makeProgram;
std::string makeCommand =
cmSystemTools::FindProgram(makeProgram, mp);
if(makeCommand.size() == 0)
{
std::string e = "Generator cannot find Visual Studio 6 msdev program \"";
e += originalCommand;
e += "\" specified by CMAKE_MAKE_PROGRAM cache entry. ";
e += "Please fix the setting.";
cmSystemTools::Error(e.c_str());
return "";
}
makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
// if there are spaces in the makeCommand, assume a full path makeCommand.push_back(std::string(projectName)+".dsw");
// and convert it to a path with no spaces in it as the makeCommand.push_back("/MAKE");
// RunSingleCommand does not like spaces std::string targetArg;
#if defined(_WIN32) && !defined(__CYGWIN__)
if(makeCommand.find(' ') != std::string::npos)
{
cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand);
}
#endif
makeCommand += " ";
makeCommand += projectName;
makeCommand += ".dsw /MAKE \"";
bool clean = false; bool clean = false;
if ( targetName && strcmp(targetName, "clean") == 0 ) if ( targetName && strcmp(targetName, "clean") == 0 )
{ {
@ -131,35 +132,32 @@ std::string cmGlobalVisualStudio6Generator
} }
if (targetName && strlen(targetName)) if (targetName && strlen(targetName))
{ {
makeCommand += targetName; targetArg += targetName;
} }
else else
{ {
makeCommand += "ALL_BUILD"; targetArg += "ALL_BUILD";
} }
makeCommand += " - "; targetArg += " - ";
if(config && strlen(config)) if(config && strlen(config))
{ {
makeCommand += config; targetArg += config;
} }
else else
{ {
makeCommand += "Debug"; targetArg += "Debug";
} }
makeCommand.push_back(targetArg);
if(clean) if(clean)
{ {
makeCommand += "\" /CLEAN"; makeCommand.push_back("/CLEAN");
} }
else else
{ {
makeCommand += "\" /BUILD"; makeCommand.push_back("/BUILD");
} }
if ( additionalOptions ) makeCommand.insert(makeCommand.end(),
{ makeOptions.begin(), makeOptions.end());
makeCommand += " ";
makeCommand += additionalOptions;
}
return makeCommand;
} }
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator

View File

@ -52,14 +52,16 @@ public:
* Try running cmake and building a file. This is used for dynalically * Try running cmake and building a file. This is used for dynalically
* loaded commands, not as part of the usual build process. * loaded commands, not as part of the usual build process.
*/ */
virtual std::string GenerateBuildCommand(const char* makeProgram, virtual void GenerateBuildCommand(
const char *projectName, std::vector<std::string>& makeCommand,
const char *projectDir, const char* makeProgram,
const char* additionalOptions, const char* projectName,
const char *targetName, const char* projectDir,
const char* config, const char* targetName,
bool ignoreErrors, const char* config,
bool fast); bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/** /**
* Generate the all required files for building this project/tree. This * Generate the all required files for building this project/tree. This
@ -90,6 +92,7 @@ public:
protected: protected:
virtual const char* GetIDEVersion() { return "6.0"; } virtual const char* GetIDEVersion() { return "6.0"; }
private: private:
virtual std::string GetVSMakeProgram() { return this->GetMSDevCommand(); }
void GenerateConfigurations(cmMakefile* mf); void GenerateConfigurations(cmMakefile* mf);
void WriteDSWFile(std::ostream& fout); void WriteDSWFile(std::ostream& fout);
void WriteDSWHeader(std::ostream& fout); void WriteDSWHeader(std::ostream& fout);
@ -100,6 +103,10 @@ private:
const std::set<cmStdString>& dependencies); const std::set<cmStdString>& dependencies);
void WriteDSWFooter(std::ostream& fout); void WriteDSWFooter(std::ostream& fout);
virtual std::string WriteUtilityDepend(cmTarget* target); virtual std::string WriteUtilityDepend(cmTarget* target);
std::string MSDevCommand;
bool MSDevCommandInitialized;
std::string const& GetMSDevCommand();
std::string FindMSDevCommand();
}; };
#endif #endif

View File

@ -19,7 +19,6 @@
cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator( cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(
const char* platformName) : cmGlobalVisualStudio7Generator(platformName) const char* platformName) : cmGlobalVisualStudio7Generator(platformName)
{ {
this->FindMakeProgramFile = "CMakeVS71FindMake.cmake";
this->ProjectConfigurationSectionName = "ProjectConfiguration"; this->ProjectConfigurationSectionName = "ProjectConfiguration";
} }

View File

@ -20,8 +20,8 @@
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
const char* platformName) const char* platformName)
{ {
this->FindMakeProgramFile = "CMakeVS7FindMake.cmake";
this->IntelProjectVersion = 0; this->IntelProjectVersion = 0;
this->DevEnvCommandInitialized = false;
if (!platformName) if (!platformName)
{ {
@ -110,35 +110,60 @@ void cmGlobalVisualStudio7Generator
} }
std::string cmGlobalVisualStudio7Generator //----------------------------------------------------------------------------
::GenerateBuildCommand(const char* makeProgram, std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand()
const char *projectName, const char *projectDir,
const char* additionalOptions, const char *targetName,
const char* config, bool ignoreErrors, bool)
{ {
// Visual studio 7 doesn't need project dir if(!this->DevEnvCommandInitialized)
(void) projectDir;
// Ingoring errors is not implemented in visual studio 6
(void) ignoreErrors;
// now build the test
std::string makeCommand =
cmSystemTools::ConvertToOutputPath(makeProgram);
std::string lowerCaseCommand = makeCommand;
cmSystemTools::LowerCase(lowerCaseCommand);
// if there are spaces in the makeCommand, assume a full path
// and convert it to a path with no spaces in it as the
// RunSingleCommand does not like spaces
#if defined(_WIN32) && !defined(__CYGWIN__)
if(makeCommand.find(' ') != std::string::npos)
{ {
cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand); this->DevEnvCommandInitialized = true;
this->DevEnvCommand = this->FindDevEnvCommand();
} }
#endif return this->DevEnvCommand;
makeCommand += " "; }
makeCommand += projectName;
makeCommand += ".sln "; //----------------------------------------------------------------------------
std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand()
{
std::string vscmd;
std::string vskey = this->GetRegistryBase() + ";InstallDir";
if(cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd,
cmSystemTools::KeyWOW64_32))
{
cmSystemTools::ConvertToUnixSlashes(vscmd);
vscmd += "/";
}
vscmd += "devenv.com";
return vscmd;
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
const char* projectName,
const char* /*projectDir*/,
const char* targetName,
const char* config,
bool /*fast*/,
std::vector<std::string> const& makeOptions)
{
// Select the caller- or user-preferred make program, else devenv.
std::string makeProgramSelected =
this->SelectMakeProgram(makeProgram, this->GetDevEnvCommand());
// Ignore the above preference if it is msbuild.
// Assume any other value is either a devenv or
// command-line compatible with devenv.
std::string makeProgramLower = makeProgramSelected;
cmSystemTools::LowerCase(makeProgramLower);
if(makeProgramLower.find("msbuild") != std::string::npos)
{
makeProgramSelected = this->GetDevEnvCommand();
}
makeCommand.push_back(makeProgramSelected);
makeCommand.push_back(std::string(projectName) + ".sln");
bool clean = false; bool clean = false;
if ( targetName && strcmp(targetName, "clean") == 0 ) if ( targetName && strcmp(targetName, "clean") == 0 )
{ {
@ -147,37 +172,33 @@ std::string cmGlobalVisualStudio7Generator
} }
if(clean) if(clean)
{ {
makeCommand += "/clean "; makeCommand.push_back("/clean");
} }
else else
{ {
makeCommand += "/build "; makeCommand.push_back("/build");
} }
if(config && strlen(config)) if(config && strlen(config))
{ {
makeCommand += config; makeCommand.push_back(config);
} }
else else
{ {
makeCommand += "Debug"; makeCommand.push_back("Debug");
} }
makeCommand += " /project "; makeCommand.push_back("/project");
if (targetName && strlen(targetName)) if (targetName && strlen(targetName))
{ {
makeCommand += targetName; makeCommand.push_back(targetName);
} }
else else
{ {
makeCommand += "ALL_BUILD"; makeCommand.push_back("ALL_BUILD");
} }
if ( additionalOptions ) makeCommand.insert(makeCommand.end(),
{ makeOptions.begin(), makeOptions.end());
makeCommand += " ";
makeCommand += additionalOptions;
}
return makeCommand;
} }
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator

View File

@ -60,14 +60,16 @@ public:
* Try running cmake and building a file. This is used for dynamically * Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process. * loaded commands, not as part of the usual build process.
*/ */
virtual std::string GenerateBuildCommand(const char* makeProgram, virtual void GenerateBuildCommand(
const char *projectName, std::vector<std::string>& makeCommand,
const char *projectDir, const char* makeProgram,
const char* additionalOptions, const char* projectName,
const char *targetName, const char* projectDir,
const char* config, const char* targetName,
bool ignoreErrors, const char* config,
bool fast); bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/** /**
* Generate the all required files for building this project/tree. This * Generate the all required files for building this project/tree. This
@ -108,6 +110,9 @@ public:
protected: protected:
virtual const char* GetIDEVersion() { return "7.0"; } virtual const char* GetIDEVersion() { return "7.0"; }
std::string const& GetDevEnvCommand();
virtual std::string FindDevEnvCommand();
static cmIDEFlagTable const* GetExtraFlagTableVS7(); static cmIDEFlagTable const* GetExtraFlagTableVS7();
virtual void OutputSLNFile(cmLocalGenerator* root, virtual void OutputSLNFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators); std::vector<cmLocalGenerator*>& generators);
@ -166,6 +171,9 @@ protected:
private: private:
char* IntelProjectVersion; char* IntelProjectVersion;
std::string DevEnvCommand;
bool DevEnvCommandInitialized;
virtual std::string GetVSMakeProgram() { return this->GetDevEnvCommand(); }
}; };
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"

View File

@ -94,7 +94,6 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
const char* additionalPlatformDefinition) const char* additionalPlatformDefinition)
: cmGlobalVisualStudio71Generator(platformName) : cmGlobalVisualStudio71Generator(platformName)
{ {
this->FindMakeProgramFile = "CMakeVS8FindMake.cmake";
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->Name = name; this->Name = name;
@ -104,6 +103,26 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
} }
} }
//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio8Generator::FindDevEnvCommand()
{
// First look for VCExpress.
std::string vsxcmd;
std::string vsxkey =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\";
vsxkey += this->GetIDEVersion();
vsxkey += ";InstallDir";
if(cmSystemTools::ReadRegistryValue(vsxkey.c_str(), vsxcmd,
cmSystemTools::KeyWOW64_32))
{
cmSystemTools::ConvertToUnixSlashes(vsxcmd);
vsxcmd += "/VCExpress.exe";
return vsxcmd;
}
// Now look for devenv.
return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()

View File

@ -69,6 +69,8 @@ public:
protected: protected:
virtual const char* GetIDEVersion() { return "8.0"; } virtual const char* GetIDEVersion() { return "8.0"; }
virtual std::string FindDevEnvCommand();
virtual bool VSLinksDependencies() const { return false; } virtual bool VSLinksDependencies() const { return false; }
bool AddCheckTarget(); bool AddCheckTarget();

View File

@ -101,7 +101,6 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(
: cmGlobalVisualStudio8Generator(name, platformName, : cmGlobalVisualStudio8Generator(name, platformName,
additionalPlatformDefinition) additionalPlatformDefinition)
{ {
this->FindMakeProgramFile = "CMakeVS9FindMake.cmake";
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -499,6 +499,19 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
} }
} }
//----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
{
// Visual Studio generators know how to lookup their build tool
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
if(cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
{
mf->AddDefinition("CMAKE_MAKE_PROGRAM",
this->GetVSMakeProgram().c_str());
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf)
{ {

View File

@ -82,6 +82,8 @@ public:
}; };
class OrderedTargetDependSet; class OrderedTargetDependSet;
virtual void FindMakeProgram(cmMakefile*);
protected: protected:
// Does this VS version link targets to each other if there are // Does this VS version link targets to each other if there are
// dependencies in the SLN file? This was done for VS versions // dependencies in the SLN file? This was done for VS versions
@ -107,6 +109,7 @@ protected:
const char* AdditionalPlatformDefinition; const char* AdditionalPlatformDefinition;
private: private:
virtual std::string GetVSMakeProgram() = 0;
void PrintCompilerAdvice(std::ostream&, std::string, const char*) {} void PrintCompilerAdvice(std::ostream&, std::string, const char*) {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const; void ComputeTargetObjects(cmGeneratorTarget* gt) const;

View File

@ -257,39 +257,30 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator void
::GenerateBuildCommand(const char* makeProgram, cmGlobalXCodeGenerator::GenerateBuildCommand(
const char *projectName, std::vector<std::string>& makeCommand,
const char *projectDir, const char* makeProgram,
const char* additionalOptions, const char* projectName,
const char *targetName, const char* /*projectDir*/,
const char* config, const char* targetName,
bool ignoreErrors, const char* config,
bool) bool /*fast*/,
std::vector<std::string> const& makeOptions)
{ {
// Config is not used yet
(void) ignoreErrors;
(void) projectDir;
// now build the test // now build the test
if(makeProgram == 0 || !strlen(makeProgram)) makeCommand.push_back(
{ this->SelectMakeProgram(makeProgram, "xcodebuild")
cmSystemTools::Error( );
"Generator cannot find the appropriate make command.");
return "";
}
std::string makeCommand =
cmSystemTools::ConvertToOutputPath(makeProgram);
std::string lowerCaseCommand = makeCommand;
cmSystemTools::LowerCase(lowerCaseCommand);
makeCommand += " -project "; makeCommand.push_back("-project");
makeCommand += projectName; std::string projectArg = projectName;
makeCommand += ".xcode"; projectArg += ".xcode";
if(this->XcodeVersion > 20) if(this->XcodeVersion > 20)
{ {
makeCommand += "proj"; projectArg += "proj";
} }
makeCommand.push_back(projectArg);
bool clean = false; bool clean = false;
if ( targetName && strcmp(targetName, "clean") == 0 ) if ( targetName && strcmp(targetName, "clean") == 0 )
@ -299,13 +290,13 @@ std::string cmGlobalXCodeGenerator
} }
if(clean) if(clean)
{ {
makeCommand += " clean"; makeCommand.push_back("clean");
} }
else else
{ {
makeCommand += " build"; makeCommand.push_back("build");
} }
makeCommand += " -target "; makeCommand.push_back("-target");
// if it is a null string for config don't use it // if it is a null string for config don't use it
if(config && *config == 0) if(config && *config == 0)
{ {
@ -313,27 +304,24 @@ std::string cmGlobalXCodeGenerator
} }
if (targetName && strlen(targetName)) if (targetName && strlen(targetName))
{ {
makeCommand += targetName; makeCommand.push_back(targetName);
} }
else else
{ {
makeCommand += "ALL_BUILD"; makeCommand.push_back("ALL_BUILD");
} }
if(this->XcodeVersion == 15) if(this->XcodeVersion == 15)
{ {
makeCommand += " -buildstyle Development "; makeCommand.push_back("-buildstyle");
makeCommand.push_back("Development");
} }
else else
{ {
makeCommand += " -configuration "; makeCommand.push_back("-configuration");
makeCommand += config?config:"Debug"; makeCommand.push_back(config?config:"Debug");
} }
if ( additionalOptions ) makeCommand.insert(makeCommand.end(),
{ makeOptions.begin(), makeOptions.end());
makeCommand += " ";
makeCommand += additionalOptions;
}
return makeCommand;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -53,14 +53,16 @@ public:
* Try running cmake and building a file. This is used for dynalically * Try running cmake and building a file. This is used for dynalically
* loaded commands, not as part of the usual build process. * loaded commands, not as part of the usual build process.
*/ */
virtual std::string GenerateBuildCommand(const char* makeProgram, virtual void GenerateBuildCommand(
const char *projectName, std::vector<std::string>& makeCommand,
const char *projectDir, const char* makeProgram,
const char* additionalOptions, const char* projectName,
const char *targetName, const char* projectDir,
const char* config, const char* targetName,
bool ignoreErrors, const char* config,
bool fast); bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/** /**
* Generate the all required files for building this project/tree. This * Generate the all required files for building this project/tree. This

View File

@ -615,9 +615,25 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
int* retVal , const char* dir , int* retVal , const char* dir ,
OutputOption outputflag , OutputOption outputflag ,
double timeout ) double timeout )
{
std::vector<std::string> cmd;
for(std::vector<cmStdString>::const_iterator i = command.begin();
i != command.end(); ++i)
{
cmd.push_back(*i);
}
return cmSystemTools::RunSingleCommand(cmd, output, retVal, dir,
outputflag, timeout);
}
bool cmSystemTools::RunSingleCommand(std::vector<std::string>const& command,
std::string* output ,
int* retVal , const char* dir ,
OutputOption outputflag ,
double timeout )
{ {
std::vector<const char*> argv; std::vector<const char*> argv;
for(std::vector<cmStdString>::const_iterator a = command.begin(); for(std::vector<std::string>::const_iterator a = command.begin();
a != command.end(); ++a) a != command.end(); ++a)
{ {
argv.push_back(a->c_str()); argv.push_back(a->c_str());
@ -779,6 +795,23 @@ bool cmSystemTools::RunSingleCommand(
dir, outputflag, timeout); dir, outputflag, timeout);
} }
std::string
cmSystemTools::PrintSingleCommand(std::vector<std::string> const& command)
{
std::string commandStr;
const char* sep = "";
for(std::vector<std::string>::const_iterator i = command.begin();
i != command.end(); ++i)
{
commandStr += sep;
commandStr += "\"";
commandStr += *i;
commandStr += "\"";
sep = " ";
}
return commandStr;
}
bool cmSystemTools::DoesFileExistWithExtensions( bool cmSystemTools::DoesFileExistWithExtensions(
const char* name, const char* name,
const std::vector<std::string>& headerExts) const std::vector<std::string>& headerExts)

View File

@ -228,12 +228,19 @@ public:
* the command to run, and each argument to the command should * the command to run, and each argument to the command should
* be in comand[1]...command[command.size()] * be in comand[1]...command[command.size()]
*/ */
static bool RunSingleCommand(std::vector<std::string> const& command,
std::string* output = 0,
int* retVal = 0, const char* dir = 0,
OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
static bool RunSingleCommand(std::vector<cmStdString> const& command, static bool RunSingleCommand(std::vector<cmStdString> const& command,
std::string* output = 0, std::string* output = 0,
int* retVal = 0, const char* dir = 0, int* retVal = 0, const char* dir = 0,
OutputOption outputflag = OUTPUT_MERGE, OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0); double timeout = 0.0);
static std::string PrintSingleCommand(std::vector<std::string> const&);
/** /**
* Parse arguments out of a single string command * Parse arguments out of a single string command
*/ */

View File

@ -2663,26 +2663,19 @@ int cmake::Build(const std::string& dir,
this->CreateGlobalGenerator(it.GetValue())); this->CreateGlobalGenerator(it.GetValue()));
std::string output; std::string output;
std::string projName; std::string projName;
std::string makeProgram;
if(!it.Find("CMAKE_PROJECT_NAME")) if(!it.Find("CMAKE_PROJECT_NAME"))
{ {
std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n"; std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
return 1; return 1;
} }
projName = it.GetValue(); projName = it.GetValue();
if(!it.Find("CMAKE_MAKE_PROGRAM"))
{
std::cerr << "Error: could not find CMAKE_MAKE_PROGRAM in Cache\n";
return 1;
}
makeProgram = it.GetValue();
return gen->Build(0, dir.c_str(), return gen->Build(0, dir.c_str(),
projName.c_str(), target.c_str(), projName.c_str(), target.c_str(),
&output, &output,
makeProgram.c_str(), 0,
config.c_str(), clean, false, 0, config.c_str(), clean, false, 0,
cmSystemTools::OUTPUT_PASSTHROUGH, cmSystemTools::OUTPUT_PASSTHROUGH,
0, nativeOptions); nativeOptions);
} }
void cmake::WatchUnusedCli(const char* var) void cmake::WatchUnusedCli(const char* var)

View File

@ -1,16 +0,0 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#define CMAKE_BINARY_DIR "${CMake_BINARY_DIR}"
#define EXECUTABLE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}"
#define MAKEPROGRAM "${MAKEPROGRAM}"
#define CMAKE_GENERATOR "${CMAKE_GENERATOR}"
#define DART_MAKECOMMAND "${MAKECOMMAND}"

10
Tests/BootstrapTest.cmake Normal file
View File

@ -0,0 +1,10 @@
file(MAKE_DIRECTORY "${bin_dir}")
message(STATUS "running bootstrap: ${bootstrap}")
execute_process(
COMMAND ${bootstrap}
WORKING_DIRECTORY "${bin_dir}"
RESULT_VARIABLE result
)
if(result)
message(FATAL_ERROR "bootstrap failed: ${result}")
endif()

View File

@ -17,29 +17,15 @@ if(CMake_TEST_INSTALL)
if(CMAKE_CONFIGURATION_TYPES) if(CMAKE_CONFIGURATION_TYPES)
# There are multiple configurations. Make sure the tested # There are multiple configurations. Make sure the tested
# configuration is the one that is installed. # configuration is the one that is installed.
set(CMake_TEST_INSTALL_CONFIG -C "\${CTEST_CONFIGURATION_TYPE}") set(CMake_TEST_INSTALL_CONFIG --config $<CONFIGURATION>)
else() else()
set(CMake_TEST_INSTALL_CONFIG) set(CMake_TEST_INSTALL_CONFIG)
endif() endif()
# The CTest of the CMake used to build this CMake.
if(CMAKE_CTEST_COMMAND)
set(CMake_TEST_INSTALL_CTest ${CMAKE_CTEST_COMMAND})
else()
set(CMake_TEST_INSTALL_CTest ${CMake_BIN_DIR}/ctest)
endif()
# Add a test to install CMake through the build system install target. # Add a test to install CMake through the build system install target.
add_test(CMake.Install add_test(NAME CMake.Install
${CMake_TEST_INSTALL_CTest} COMMAND cmake --build . --target install ${CMake_TEST_INSTALL_CONFIG}
${CMake_TEST_INSTALL_CONFIG} )
--build-and-test ${CMake_SOURCE_DIR} ${CMake_BINARY_DIR}
--build-generator ${CMAKE_GENERATOR} # Not CMAKE_TEST_GENERATOR
--build-project CMake
--build-makeprogram ${CMAKE_MAKE_PROGRAM} # Not CMAKE_TEST_MAKEPROGRAM
--build-nocmake
--build-noclean
--build-target install)
# Avoid running this test simultaneously with other tests: # Avoid running this test simultaneously with other tests:
set_tests_properties(CMake.Install PROPERTIES RUN_SERIAL ON) set_tests_properties(CMake.Install PROPERTIES RUN_SERIAL ON)

View File

@ -10,7 +10,9 @@ macro(ADD_TEST_MACRO NAME COMMAND)
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project ${proj} --build-project ${proj}
${${NAME}_EXTRA_OPTIONS} ${${NAME}_CTEST_OPTIONS}
--build-options ${build_options}
${${NAME}_BUILD_OPTIONS}
--test-command ${COMMAND} ${ARGN}) --test-command ${COMMAND} ${ARGN})
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
endmacro() endmacro()
@ -43,12 +45,25 @@ configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
# Testing # Testing
if(BUILD_TESTING) if(BUILD_TESTING)
set(CMAKE_TEST_DEVENV "")
if(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio")
set(CMAKE_TEST_MAKEPROGRAM "")
else()
set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}")
endif()
if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND
NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]")
set(CMAKE_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}")
endif()
endif()
if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32))
set(TEST_CompileCommandOutput 1) set(TEST_CompileCommandOutput 1)
endif() endif()
set(MAKE_IS_GNU ) set(MAKE_IS_GNU )
if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make) if(CMAKE_TEST_MAKEPROGRAM MATCHES make)
execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version
RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
if("${res}" STREQUAL "0") if("${res}" STREQUAL "0")
@ -60,8 +75,8 @@ if(BUILD_TESTING)
# some old versions of make simply cannot handle spaces in paths # some old versions of make simply cannot handle spaces in paths
if (MAKE_IS_GNU OR if (MAKE_IS_GNU OR
"${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR CMAKE_TEST_MAKEPROGRAM MATCHES "nmake|gmake|wmake" OR
"${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") CMAKE_TEST_GENERATOR MATCHES "Visual Studio|XCode|Borland")
set(MAKE_SUPPORTS_SPACES 1) set(MAKE_SUPPORTS_SPACES 1)
else() else()
set(MAKE_SUPPORTS_SPACES 0) set(MAKE_SUPPORTS_SPACES 0)
@ -69,7 +84,6 @@ if(BUILD_TESTING)
set(build_generator_args set(build_generator_args
--build-generator ${CMAKE_TEST_GENERATOR} --build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
) )
if(CMAKE_TEST_GENERATOR_TOOLSET) if(CMAKE_TEST_GENERATOR_TOOLSET)
list(APPEND build_generator_args list(APPEND build_generator_args
@ -77,6 +91,11 @@ if(BUILD_TESTING)
) )
endif() endif()
set(build_options)
if(CMAKE_TEST_MAKEPROGRAM)
list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
endif()
add_subdirectory(CMakeLib) add_subdirectory(CMakeLib)
add_subdirectory(CMakeOnly) add_subdirectory(CMakeOnly)
add_subdirectory(RunCMake) add_subdirectory(RunCMake)
@ -241,6 +260,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(Assembler HelloAsm) ADD_TEST_MACRO(Assembler HelloAsm)
ADD_TEST_MACRO(SourceGroups SourceGroups) ADD_TEST_MACRO(SourceGroups SourceGroups)
ADD_TEST_MACRO(Preprocess Preprocess) ADD_TEST_MACRO(Preprocess Preprocess)
set(ExportImport_BUILD_OPTIONS -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(ExportImport ExportImport)
ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(Unset Unset)
ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(PolicyScope PolicyScope)
@ -276,6 +296,7 @@ if(BUILD_TESTING)
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project InterfaceBuildTargets --build-project InterfaceBuildTargets
--build-options ${build_options}
--test-command ${CMAKE_CMAKE_COMMAND} -E touch_nocreate ${InterfaceBuildTargets_libname} --test-command ${CMAKE_CMAKE_COMMAND} -E touch_nocreate ${InterfaceBuildTargets_libname}
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceBuildTargets") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceBuildTargets")
@ -319,6 +340,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/BundleUtilities" "${CMake_BINARY_DIR}/Tests/BundleUtilities"
${build_generator_args} ${build_generator_args}
--build-project BundleUtilities --build-project BundleUtilities
--build-options ${build_options}
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleUtilities") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleUtilities")
@ -331,7 +353,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/Qt4Deploy" "${CMake_BINARY_DIR}/Tests/Qt4Deploy"
${build_generator_args} ${build_generator_args}
--build-project Qt4Deploy --build-project Qt4Deploy
--build-options --build-options ${build_options}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
) )
@ -369,7 +391,8 @@ if(BUILD_TESTING)
--build-project ExternalDataTest --build-project ExternalDataTest
--build-noclean --build-noclean
--force-new-ctest-process --force-new-ctest-process
--build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES} --build-options ${build_options}
-DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}
--test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData")
@ -402,7 +425,8 @@ if(BUILD_TESTING)
${build_generator_args} ${build_generator_args}
--build-project LinkFlags --build-project LinkFlags
--build-target LinkFlags --build-target LinkFlags
--build-options -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE} --build-options ${build_options}
-DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE}
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags")
@ -448,8 +472,8 @@ if(BUILD_TESTING)
--build-two-config --build-two-config
--build-generator "Eclipse CDT4 - Unix Makefiles" --build-generator "Eclipse CDT4 - Unix Makefiles"
--build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project Simple --build-project Simple
--build-options ${build_options}
--test-command Simple) --test-command Simple)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator")
endif () endif ()
@ -463,8 +487,8 @@ if(BUILD_TESTING)
--build-two-config --build-two-config
--build-generator "CodeBlocks - Unix Makefiles" --build-generator "CodeBlocks - Unix Makefiles"
--build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project Simple --build-project Simple
--build-options ${build_options}
--test-command Simple) --test-command Simple)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator")
endif () endif ()
@ -477,8 +501,8 @@ if(BUILD_TESTING)
--build-two-config --build-two-config
--build-generator "KDevelop3 - Unix Makefiles" --build-generator "KDevelop3 - Unix Makefiles"
--build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project Simple --build-project Simple
--build-options ${build_options}
--test-command Simple) --test-command Simple)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator")
endif () endif ()
@ -486,8 +510,8 @@ if(BUILD_TESTING)
endif() endif()
# test for correct sub-project generation # test for correct sub-project generation
# not implemented in VS6 or Xcode # not implemented in VS 6, VS 7.0, Xcode, or Ninja
if(NOT MSVC60 AND NOT XCODE AND NOT MSVC70) if(NOT CMAKE_TEST_GENERATOR MATCHES "Visual Studio [67]$|Xcode|Ninja")
# run cmake and configure all of SubProject # run cmake and configure all of SubProject
# but only build the independent executable car # but only build the independent executable car
add_test(SubProject ${CMAKE_CTEST_COMMAND} add_test(SubProject ${CMAKE_CTEST_COMMAND}
@ -497,31 +521,32 @@ if(BUILD_TESTING)
--build-project SubProject --build-project SubProject
${build_generator_args} ${build_generator_args}
--build-target car --build-target car
--build-options ${build_options}
--test-command car --test-command car
) )
if(${CMAKE_TEST_GENERATOR} MATCHES "Ninja")
# The Ninja generator does not create a recursive build system. Start
# from the root directory.
set(SubProject_SUBDIR)
else()
set(SubProject_SUBDIR "/foo")
endif()
# For stage 2, do not run cmake again. # For stage 2, do not run cmake again.
# Then build the foo sub project which should build # Then build the foo sub project which should build
# the bar library which should be referenced because # the bar library which should be referenced because
# foo links to the static library bar, but bar is not # foo links to the static library bar, but bar is not
# directly in the foo sub project # directly in the foo sub project
if(CMAKE_TEST_MAKEPROGRAM)
set(SubProject-Stage2_BUILD_MAKEPROGRAM
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
)
endif()
add_test(SubProject-Stage2 ${CMAKE_CTEST_COMMAND} add_test(SubProject-Stage2 ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/SubProject${SubProject_SUBDIR}" "${CMake_SOURCE_DIR}/Tests/SubProject/foo"
"${CMake_BINARY_DIR}/Tests/SubProject${SubProject_SUBDIR}" "${CMake_BINARY_DIR}/Tests/SubProject/foo"
${build_generator_args} --build-generator ${CMAKE_TEST_GENERATOR}
--build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
${SubProject-Stage2_BUILD_MAKEPROGRAM}
--build-nocmake --build-nocmake
--build-project foo --build-project foo
--build-target foo --build-target foo
--build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo"
--build-options ${build_options}
--test-command foo --test-command foo
) )
set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject) set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject)
@ -562,7 +587,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project Framework --build-project Framework
--build-options --build-options ${build_options}
"-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install" "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install"
--test-command bar) --test-command bar)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework")
@ -574,6 +599,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project TargetName --build-project TargetName
--build-options ${build_options}
--test-command ${CMAKE_CMAKE_COMMAND} -E compare_files --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files
${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world) ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
@ -587,6 +613,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project LibName --build-project LibName
--build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib" --build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib"
--build-options ${build_options}
--test-command foobar --test-command foobar
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName")
@ -599,6 +626,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project CustComDepend --build-project CustComDepend
--build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin"
--build-options ${build_options}
--test-command foo bar.c --test-command foo bar.c
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend")
@ -610,6 +638,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project ArgumentExpansion --build-project ArgumentExpansion
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ArgumentExpansion/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/ArgumentExpansion/bin"
--build-options ${build_options}
) )
set_tests_properties(ArgumentExpansion PROPERTIES set_tests_properties(ArgumentExpansion PROPERTIES
FAIL_REGULAR_EXPRESSION "Unexpected: ") FAIL_REGULAR_EXPRESSION "Unexpected: ")
@ -621,7 +650,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/GeneratorExpression" "${CMake_BINARY_DIR}/Tests/GeneratorExpression"
${build_generator_args} ${build_generator_args}
--build-project GeneratorExpression --build-project GeneratorExpression
--build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} --build-options ${build_options}
-DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
--test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression")
@ -634,6 +664,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project CustomCommand --build-project CustomCommand
--build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
--build-options ${build_options}
--test-command CustomCommand --test-command CustomCommand
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand")
@ -647,6 +678,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project TestWorkingDir --build-project TestWorkingDir
--build-options ${build_options}
--test-command working --test-command working
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory")
@ -658,6 +690,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# ${build_generator_args} # ${build_generator_args}
# --build-project SimpleExclude # --build-project SimpleExclude
# --build-two-config # --build-two-config
# --build-options ${build_options}
# --test-command t4 # --test-command t4
#--test-command "${CMAKE_COMMAND}" #--test-command "${CMAKE_COMMAND}"
#"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}" #"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}"
@ -671,6 +704,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# ${build_generator_args} # ${build_generator_args}
# --build-project SameName # --build-project SameName
# --build-two-config # --build-two-config
# --build-options ${build_options}
# --test-command # --test-command
# "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2") # "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2")
@ -681,6 +715,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project OutOfSource --build-project OutOfSource
--build-two-config --build-two-config
--build-options ${build_options}
--test-command --test-command
"${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple") "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource")
@ -693,6 +728,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/BuildDepends" "${CMake_BINARY_DIR}/Tests/BuildDepends"
${build_generator_args} ${build_generator_args}
--build-project BuildDepends --build-project BuildDepends
--build-options ${build_options}
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
@ -705,7 +741,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project TestSimpleInstall --build-project TestSimpleInstall
--build-two-config --build-two-config
--build-options --build-options ${build_options}
"-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
"-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}" "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}"
--test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe) --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe)
@ -717,7 +753,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project TestSimpleInstall --build-project TestSimpleInstall
--build-two-config --build-two-config
--build-options --build-options ${build_options}
"-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
"-DSTAGE2:BOOL=1" "-DSTAGE2:BOOL=1"
--test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2) --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2)
@ -771,6 +807,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
${build_generator_args} ${build_generator_args}
--build-project CPackWiXGenerator --build-project CPackWiXGenerator
--build-options ${build_options}
--test-command ${CMAKE_CMAKE_COMMAND} --test-command ${CMAKE_CMAKE_COMMAND}
"-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
-P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake") -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake")
@ -778,12 +815,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endif() endif()
if(CTEST_RUN_CPackComponents) if(CTEST_RUN_CPackComponents)
set(CPackComponents_EXTRA_OPTIONS) set(CPackComponents_BUILD_OPTIONS)
if(APPLE) if(APPLE)
set(CPackComponents_EXTRA_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
endif() endif()
if(NSIS_MAKENSIS_EXECUTABLE) if(NSIS_MAKENSIS_EXECUTABLE)
set(CPackComponents_EXTRA_OPTIONS ${CPackComponents_EXTRA_OPTIONS} set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
-DCPACK_BINARY_NSIS:BOOL=ON) -DCPACK_BINARY_NSIS:BOOL=ON)
endif() endif()
@ -795,10 +832,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project CPackComponents --build-project CPackComponents
--build-two-config --build-two-config
--build-target package --build-target package
--build-options --build-options ${build_options}
-DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB} -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
-DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM} -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
${CPackComponents_EXTRA_OPTIONS} ${CPackComponents_BUILD_OPTIONS}
--graphviz=CPackComponents.dot --graphviz=CPackComponents.dot
--test-command ${CMAKE_CMAKE_COMMAND} --test-command ${CMAKE_CMAKE_COMMAND}
"-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents" "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents"
@ -822,7 +859,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# ACTIVE_CPACK_GENERATORS variable # ACTIVE_CPACK_GENERATORS variable
# now contains the list of 'active generators' # now contains the list of 'active generators'
set(CPackComponentsForAll_EXTRA_OPTIONS) set(CPackComponentsForAll_BUILD_OPTIONS)
# set up list of CPack generators # set up list of CPack generators
list(APPEND GENLST "ZIP") list(APPEND GENLST "ZIP")
if(APPLE) if(APPLE)
@ -854,10 +891,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}" "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}"
${build_generator_args} ${build_generator_args}
--build-project CPackComponentsForAll --build-project CPackComponentsForAll
--build-options --build-options ${build_options}
-DCPACK_BINARY_${CPackGen}:BOOL=ON -DCPACK_BINARY_${CPackGen}:BOOL=ON
${CPackRun_CPackComponentWay} ${CPackRun_CPackComponentWay}
${CPackComponentsForAll_EXTRA_OPTIONS} ${CPackComponentsForAll_BUILD_OPTIONS}
--graphviz=CPackComponentsForAll.dot --graphviz=CPackComponentsForAll.dot
--test-command ${CMAKE_CMAKE_COMMAND} --test-command ${CMAKE_CMAKE_COMMAND}
"-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}" "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}"
@ -891,6 +928,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators" "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators"
${build_generator_args} ${build_generator_args}
--build-project CPackTestAllGenerators --build-project CPackTestAllGenerators
--build-options ${build_options}
--test-command --test-command
${CMAKE_CMAKE_COMMAND} ${CMAKE_CMAKE_COMMAND}
-D dir=${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators -D dir=${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators
@ -913,6 +951,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project UseX11 --build-project UseX11
--build-two-config --build-two-config
${X11_build_target_arg} ${X11_build_target_arg}
--build-options ${build_options}
--test-command UseX11) --test-command UseX11)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11")
@ -966,6 +1005,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig" "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig"
${build_generator_args} ${build_generator_args}
--build-project LoadCommand --build-project LoadCommand
--build-options ${build_options}
--test-command LoadedCommand --test-command LoadedCommand
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig")
@ -979,7 +1019,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project Complex --build-project Complex
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin"
--build-options --build-options ${build_options}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
--test-command complex --test-command complex
) )
@ -992,7 +1032,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project Complex --build-project Complex
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
--build-options --build-options ${build_options}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
--test-command complex) --test-command complex)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig")
@ -1006,6 +1046,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project HELLO --build-project HELLO
--build-exe-dir "${CMake_BINARY_DIR}/Example/Demo" --build-exe-dir "${CMake_BINARY_DIR}/Example/Demo"
--build-options ${build_options}
--test-command helloDemo --test-command helloDemo
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Example") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Example")
@ -1018,6 +1059,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project EnvironmentProj --build-project EnvironmentProj
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Environment" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Environment"
--force-new-ctest-process --force-new-ctest-process
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V --test-command ${CMAKE_CTEST_COMMAND} -V
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment")
@ -1028,7 +1070,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/QtAutomocNoQt" "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt"
${build_generator_args} ${build_generator_args}
--build-project QtAutomocNoQt --build-project QtAutomocNoQt
--build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} --build-options ${build_options}
-DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt")
@ -1051,7 +1094,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project QtAutogen --build-project QtAutogen
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Autogen" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Autogen"
--force-new-ctest-process --force-new-ctest-process
--build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5 --build-options ${build_options}
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
--test-command ${run_autogen_test} --test-command ${run_autogen_test}
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen")
@ -1065,7 +1109,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project QtAutogen --build-project QtAutogen
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Autogen" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Autogen"
--force-new-ctest-process --force-new-ctest-process
--build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4 --build-options ${build_options}
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
--test-command ${run_autogen_test} --test-command ${run_autogen_test}
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen")
@ -1078,7 +1123,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project Qt4Targets --build-project Qt4Targets
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Targets" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Targets"
--force-new-ctest-process --force-new-ctest-process
--build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} --build-options ${build_options}
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
--test-command ${CMAKE_CTEST_COMMAND} -V --test-command ${CMAKE_CTEST_COMMAND} -V
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets")
@ -1092,6 +1138,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project Qt4And5Automoc --build-project Qt4And5Automoc
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc"
--force-new-ctest-process --force-new-ctest-process
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V --test-command ${CMAKE_CTEST_COMMAND} -V
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc")
@ -1111,6 +1158,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project ExternalProjectTest --build-project ExternalProjectTest
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject" --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject"
--force-new-ctest-process --force-new-ctest-process
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V --test-command ${CMAKE_CTEST_COMMAND} -V
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject")
@ -1125,6 +1173,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project ExternalProjectUpdateTest --build-project ExternalProjectUpdateTest
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate" --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate"
--force-new-ctest-process --force-new-ctest-process
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V --test-command ${CMAKE_CTEST_COMMAND} -V
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate")
@ -1137,7 +1186,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
-DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate -DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate
-DCMAKE_TEST_GENERATOR=${CMAKE_TEST_GENERATOR} -DCMAKE_TEST_GENERATOR=${CMAKE_TEST_GENERATOR}
-DCMAKE_TEST_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET} -DCMAKE_TEST_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET}
-DCMAKE_TEST_MAKEPROGRAM=${CMAKE_TEST_MAKEPROGRAM}
-DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND} -DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND}
-P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake -P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake
) )
@ -1156,6 +1204,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project Tutorial --build-project Tutorial
--build-options ${build_options}
--test-command Tutorial 25.0) --test-command Tutorial 25.0)
endforeach() endforeach()
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial")
@ -1166,6 +1215,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/Testing" "${CMake_BINARY_DIR}/Tests/Testing"
${build_generator_args} ${build_generator_args}
--build-project Testing --build-project Testing
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
) )
set_tests_properties(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed") set_tests_properties(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed")
@ -1178,6 +1228,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project Wrapping --build-project Wrapping
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
--build-options ${build_options}
--test-command wrapping --test-command wrapping
) )
add_test(qtwrapping ${CMAKE_CTEST_COMMAND} add_test(qtwrapping ${CMAKE_CTEST_COMMAND}
@ -1187,6 +1238,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project Wrapping --build-project Wrapping
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
--build-options ${build_options}
--test-command qtwrapping --test-command qtwrapping
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Wrapping") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Wrapping")
@ -1198,6 +1250,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
--build-project TestDriverTest --build-project TestDriverTest
--build-options ${build_options}
--test-command TestDriverTest test1 --test-command TestDriverTest test1
) )
@ -1208,6 +1261,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
--build-project TestDriverTest --build-project TestDriverTest
--build-options ${build_options}
--test-command TestDriverTest test2 --test-command TestDriverTest test2
) )
@ -1218,6 +1272,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
--build-project TestDriverTest --build-project TestDriverTest
--build-options ${build_options}
--test-command TestDriverTest subdir/test3 --test-command TestDriverTest subdir/test3
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestDriver") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestDriver")
@ -1229,6 +1284,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec"
${build_generator_args} ${build_generator_args}
--build-project Dependency --build-project Dependency
--build-options ${build_options}
--test-command exec --test-command exec
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency")
@ -1258,7 +1314,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable"
--build-project Jump --build-project Jump
${build_generator_args} ${build_generator_args}
--build-options --build-options ${build_options}
-DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib
--test-command jumpExecutable --test-command jumpExecutable
) )
@ -1271,6 +1327,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable" --build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
--build-project Jump --build-project Jump
${build_generator_args} ${build_generator_args}
--build-options ${build_options}
--test-command jumpExecutable --test-command jumpExecutable
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Jump") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Jump")
@ -1282,6 +1339,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project Plugin --build-project Plugin
--build-two-config --build-two-config
--build-options ${build_options}
--test-command bin/example) --test-command bin/example)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Plugin") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Plugin")
@ -1297,6 +1355,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/MacRuntimePath" "${CMake_BINARY_DIR}/Tests/MacRuntimePath"
${build_generator_args} ${build_generator_args}
--build-project MacRuntimePath --build-project MacRuntimePath
--build-options ${build_options}
-DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}
) )
endif() endif()
@ -1306,6 +1366,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/LinkLineOrder" "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
${build_generator_args} ${build_generator_args}
--build-project LinkLineOrder --build-project LinkLineOrder
--build-options ${build_options}
--test-command Exec1 --test-command Exec1
) )
@ -1315,6 +1376,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/LinkLineOrder" "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
${build_generator_args} ${build_generator_args}
--build-project LinkLineOrder --build-project LinkLineOrder
--build-options ${build_options}
--test-command Exec2 --test-command Exec2
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder")
@ -1335,7 +1397,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/LinkStatic" "${CMake_BINARY_DIR}/Tests/LinkStatic"
${build_generator_args} ${build_generator_args}
--build-project LinkStatic --build-project LinkStatic
--build-options -DMATH_LIBRARY:FILEPATH=/usr/lib/libm.a --build-options ${build_options}
-DMATH_LIBRARY:FILEPATH=/usr/lib/libm.a
--test-command LinkStatic --test-command LinkStatic
) )
endif() endif()
@ -1347,6 +1410,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/kwsys" "${CMake_BINARY_DIR}/Tests/kwsys"
${build_generator_args} ${build_generator_args}
--build-project kwsys --build-project kwsys
--build-options ${build_options}
--test-command kwsysTestsCxx testIOS --test-command kwsysTestsCxx testIOS
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys")
@ -1361,6 +1425,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources" "${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources"
${build_generator_args} ${build_generator_args}
--build-project SUBDIR --build-project SUBDIR
--build-options ${build_options}
--test-command test --test-command test
"${CMake_BINARY_DIR}/Tests/SubDirSpaces/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDirSpaces/ShouldBeHere"
"${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj" "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj"
@ -1376,6 +1441,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
${build_generator_args} ${build_generator_args}
--build-project SUBDIR --build-project SUBDIR
--build-options ${build_options}
--test-command test --test-command test
"${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
"${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj"
@ -1388,6 +1454,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
${build_generator_args} ${build_generator_args}
--build-project SUBDIR --build-project SUBDIR
--build-options ${build_options}
--test-command test --test-command test
"${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
"${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o"
@ -1415,6 +1482,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project MakeClean --build-project MakeClean
--build-exe-dir "${CMake_BINARY_DIR}/MakeClean" --build-exe-dir "${CMake_BINARY_DIR}/MakeClean"
--build-options ${build_options}
--test-command check_clean --test-command check_clean
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean")
@ -1428,7 +1496,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# Look for evidence that this is a VCExpress build. If so, avoid # Look for evidence that this is a VCExpress build. If so, avoid
# the MFC test by default. # the MFC test by default.
string(TOLOWER "${CMAKE_TEST_MAKEPROGRAM}" mkprog) string(TOLOWER "${CMAKE_MAKE_PROGRAM};${CMAKE_TEST_MAKEPROGRAM}" mkprog)
if(mkprog MATCHES "vcexpress") if(mkprog MATCHES "vcexpress")
message(STATUS message(STATUS
"CMAKE_TEST_MAKEPROGRAM indicates vcexpress, avoiding MFC test") "CMAKE_TEST_MAKEPROGRAM indicates vcexpress, avoiding MFC test")
@ -1519,6 +1587,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project mfc_driver --build-project mfc_driver
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} --test-command ${CMAKE_CTEST_COMMAND}
-C \${CTEST_CONFIGURATION_TYPE} -VV) -C \${CTEST_CONFIGURATION_TYPE} -VV)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC")
@ -1541,6 +1610,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project VSExternalInclude --build-project VSExternalInclude
--build-options ${build_options}
--test-command VSExternalInclude) --test-command VSExternalInclude)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExternalInclude") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExternalInclude")
@ -1551,10 +1621,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project VSMidl --build-project VSMidl
--build-options ${build_options}
--test-command VSMidl) --test-command VSMidl)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl")
if(NOT MSVC60 AND NOT CMAKE_TEST_MAKEPROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") if(CMAKE_TEST_DEVENV)
# The test (and tested property) works with .sln files, so it's skipped when: # The test (and tested property) works with .sln files, so it's skipped when:
# * Using VS6, which doesn't use .sln files # * Using VS6, which doesn't use .sln files
# * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file # * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file
@ -1566,7 +1637,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild" "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild"
--build-config ${config} --build-config ${config}
--build-two-config --build-two-config
${build_generator_args} --build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_DEVENV}
--build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
--build-project VSExcludeFromDefaultBuild --build-project VSExcludeFromDefaultBuild
--test-command ${CMAKE_COMMAND} --test-command ${CMAKE_COMMAND}
-D "activeConfig=${config}" -D "activeConfig=${config}"
@ -1583,31 +1656,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endif() endif()
if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio ([0-5]|[6-9][0-9])") if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio ([0-5]|[6-9][0-9])")
if(CMAKE_TEST_MAKEPROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") # This is Visual Studio 10 or above, so the default build tool is MSBuild.
set(MSBUILD_EXECUTABLE "${CMAKE_TEST_MAKEPROGRAM}") add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND}
else() --build-and-test
if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio (12)") "${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir"
set(_msbuild_hints "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\${CMAKE_MATCH_1}.0;MSBuildToolsPath]") "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir"
else() --build-two-config
set(_FDIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkDir32]") --build-generator ${CMAKE_TEST_GENERATOR}
set(_FVER "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkVer32]") --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
set(_msbuild_hints ${_FDIR}/${_FVER}) --build-project VSProjectInSubdir
endif() --build-target test)
find_program(MSBUILD_EXECUTABLE NAMES msbuild HINTS ${_msbuild_hints}) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir")
endif()
if(MSBUILD_EXECUTABLE)
add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir"
"${CMake_BINARY_DIR}/Tests/VSProjectInSubdir"
--build-two-config
--build-generator ${CMAKE_TEST_GENERATOR}
--build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
--build-makeprogram "${MSBUILD_EXECUTABLE}"
--build-project VSProjectInSubdir
--build-target test)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir")
endif()
endif() endif()
endif() endif()
@ -1624,7 +1683,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project BundleTest --build-project BundleTest
--build-target install --build-target install
# --build-target package # --build-target package
--build-options "-DCMAKE_INSTALL_PREFIX:PATH=${BundleTestInstallDir}" --build-options ${build_options}
"-DCMAKE_INSTALL_PREFIX:PATH=${BundleTestInstallDir}"
"-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}" "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
--test-command --test-command
${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe) ${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe)
@ -1637,6 +1697,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project CFBundleTest --build-project CFBundleTest
--build-options ${build_options}
--test-command --test-command
${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=\${CTEST_CONFIGURATION_TYPE} ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=\${CTEST_CONFIGURATION_TYPE}
-Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest -Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest
@ -1657,7 +1718,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project BundleGeneratorTest --build-project BundleGeneratorTest
--build-target package --build-target package
--build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory" --build-options ${build_options}
"-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory"
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest")
endif() endif()
@ -1669,7 +1731,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-noclean --build-noclean
--build-project WarnUnusedUnusedViaSet --build-project WarnUnusedUnusedViaSet
--build-options "--warn-unused-vars") --build-options ${build_options}
"--warn-unused-vars")
set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES
PASS_REGULAR_EXPRESSION "unused variable \\(changing definition\\) 'UNUSED_VARIABLE'") PASS_REGULAR_EXPRESSION "unused variable \\(changing definition\\) 'UNUSED_VARIABLE'")
set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES
@ -1683,7 +1746,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-noclean --build-noclean
--build-project WarnUnusedUnusedViaUnset --build-project WarnUnusedUnusedViaUnset
--build-options "--warn-unused-vars") --build-options ${build_options}
"--warn-unused-vars")
set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:7 \\(set\\):") PASS_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:7 \\(set\\):")
set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
@ -1702,7 +1766,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused" "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
${build_generator_args} ${build_generator_args}
--build-project WarnUnusedCliUnused --build-project WarnUnusedCliUnused
--build-options "-DUNUSED_CLI_VARIABLE=Unused") --build-options ${build_options}
"-DUNUSED_CLI_VARIABLE=Unused")
set_tests_properties(WarnUnusedCliUnused PROPERTIES set_tests_properties(WarnUnusedCliUnused PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE") PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
@ -1715,7 +1780,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-noclean --build-noclean
--build-project WarnUnusedCliUsed --build-project WarnUnusedCliUsed
--build-options "-DUSED_VARIABLE=Usage proven") --build-options ${build_options}
"-DUSED_VARIABLE=Usage proven")
set_tests_properties(WarnUnusedCliUsed PROPERTIES set_tests_properties(WarnUnusedCliUsed PROPERTIES
PASS_REGULAR_EXPRESSION "Usage proven") PASS_REGULAR_EXPRESSION "Usage proven")
set_tests_properties(WarnUnusedCliUsed PROPERTIES set_tests_properties(WarnUnusedCliUsed PROPERTIES
@ -1729,7 +1795,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-noclean --build-noclean
--build-project WarnUninitialized --build-project WarnUninitialized
--build-options "--warn-uninitialized") --build-options ${build_options}
"--warn-uninitialized")
set_tests_properties(WarnUninitialized PROPERTIES set_tests_properties(WarnUninitialized PROPERTIES
PASS_REGULAR_EXPRESSION "uninitialized variable 'USED_VARIABLE'") PASS_REGULAR_EXPRESSION "uninitialized variable 'USED_VARIABLE'")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUninitialized") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUninitialized")
@ -1742,6 +1809,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project TestsWorkingDirectoryProj --build-project TestsWorkingDirectoryProj
--build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory"
--force-new-ctest-process --force-new-ctest-process
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE} --test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE}
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory")
@ -1758,17 +1826,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# ) # )
# A test for ctest_build() with targets in subdirectories # A test for ctest_build() with targets in subdirectories
set(ctest_configure_options)
if(CMAKE_TEST_GENERATOR_TOOLSET) if(CMAKE_TEST_GENERATOR_TOOLSET)
set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION "-T;${CMAKE_TEST_GENERATOR_TOOLSET};") list(APPEND ctest_configure_options -T ${CMAKE_TEST_GENERATOR_TOOLSET})
else() endif()
set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION) if(CMAKE_TEST_MAKEPROGRAM)
list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
endif() endif()
configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in" configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY) "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY)
unset(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION) unset(ctest_configure_options)
add_test(CTest.BuildCommand.ProjectInSubdir add_test(CTest.BuildCommand.ProjectInSubdir
${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake")
-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/Nested") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/Nested")
set(CTEST_TEST_UPDATE 1) set(CTEST_TEST_UPDATE 1)
@ -2138,7 +2207,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--output-on-failure -C "\${CTestTest_CONFIG}") --output-on-failure -C "\${CTestTest_CONFIG}")
if(NOT BORLAND) if(NOT BORLAND)
set(CTestLimitDashJ_EXTRA_OPTIONS --force-new-ctest-process) set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process)
add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4 add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4
--output-on-failure -C "\${CTestTest_CONFIG}") --output-on-failure -C "\${CTestTest_CONFIG}")
endif() endif()
@ -2413,16 +2482,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endif() endif()
endif() endif()
if(bootstrap) if(bootstrap)
add_test(BootstrapTest ${CMAKE_CTEST_COMMAND} add_test(NAME BootstrapTest
--build-and-test COMMAND ${CMAKE_CMAKE_COMMAND}
${CMake_SOURCE_DIR} -D "bootstrap=${bootstrap}"
${CMake_BINARY_DIR}/Tests/BootstrapTest -D "bin_dir=${CMake_BINARY_DIR}/Tests/BootstrapTest"
--build-nocmake -P ${CMAKE_CURRENT_SOURCE_DIR}/BootstrapTest.cmake
--build-noclean )
--build-makeprogram ${bootstrap}
--build-generator "${CMAKE_TEST_GENERATOR}"
--test-command
${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest")
# Make this test run early during parallel execution # Make this test run early during parallel execution
set_tests_properties(BootstrapTest PROPERTIES COST 5000) set_tests_properties(BootstrapTest PROPERTIES COST 5000)
@ -2443,6 +2508,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project testf --build-project testf
--build-two-config --build-two-config
--build-options ${build_options}
-DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}
--test-command testf) --test-command testf)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran")
@ -2461,6 +2528,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args} ${build_generator_args}
--build-project FortranC --build-project FortranC
--build-two-config --build-two-config
--build-options ${build_options}
--test-command CMakeFiles/FortranCInterface/FortranCInterface) --test-command CMakeFiles/FortranCInterface/FortranCInterface)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC")
endif() endif()
@ -2484,6 +2552,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project hello --build-project hello
--build-two-config --build-two-config
--build-run-dir "${CMake_BINARY_DIR}/Tests/Java/" --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/"
--build-options ${build_options}
--test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld) --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java")
endif() endif()
@ -2503,7 +2572,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc" "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc"
${build_generator_args} ${build_generator_args}
--build-project SimpleC --build-project SimpleC
--build-options --build-options ${build_options}
"-DCMAKE_SYSTEM_NAME=Generic" "-DCMAKE_SYSTEM_NAME=Generic"
"-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}") "-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc")
@ -2521,7 +2590,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win" "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win"
${build_generator_args} ${build_generator_args}
--build-project Simple --build-project Simple
--build-options --build-options ${build_options}
"-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_SYSTEM_NAME=Windows"
"-DCMAKE_C_COMPILER=${MINGW_CC_LINUX2WIN_EXECUTABLE}" "-DCMAKE_C_COMPILER=${MINGW_CC_LINUX2WIN_EXECUTABLE}"
"-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}" "-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}"
@ -2531,19 +2600,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endif() endif()
endif() endif()
if(UNIX)
string(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix"
PREFIX_IS_FOR_TEST)
if(PREFIX_IS_FOR_TEST)
configure_file(
${CMake_SOURCE_DIR}/Tests/TestInstall.sh.in
${CMake_BINARY_DIR}/Tests/TestShellInstall/TestInstall.sh
@ONLY
)
add_test(ShellInstall /bin/sh ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestShellInstall.sh)
endif()
endif()
if(CMAKE_TEST_PROJECT_CSE_DIR) if(CMAKE_TEST_PROJECT_CSE_DIR)
set(script "${CMAKE_TEST_PROJECT_CSE_DIR}/BuildProjectCSE.cmake") set(script "${CMAKE_TEST_PROJECT_CSE_DIR}/BuildProjectCSE.cmake")
if(NOT EXISTS "${script}") if(NOT EXISTS "${script}")
@ -2615,8 +2671,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endforeach() endforeach()
if(TEST_CompileCommandOutput) if(TEST_CompileCommandOutput)
set(CompileCommandOutput_EXTRA_OPTIONS set(CompileCommandOutput_BUILD_OPTIONS
--build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}) -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES})
ADD_TEST_MACRO(CompileCommandOutput ADD_TEST_MACRO(CompileCommandOutput
"${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands") "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands")
endif() endif()
@ -2628,6 +2684,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project IncludeDirectories --build-project IncludeDirectories
--build-options ${build_options}
--test-command IncludeDirectories) --test-command IncludeDirectories)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories")
@ -2638,6 +2695,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
${build_generator_args} ${build_generator_args}
--build-project InterfaceLinkLibraries --build-project InterfaceLinkLibraries
--build-options ${build_options}
--test-command InterfaceLinkLibraries) --test-command InterfaceLinkLibraries)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries")

View File

@ -8,5 +8,5 @@ set(CTEST_BUILD_CONFIGURATION "@CTestTest_CONFIG@")
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
ctest_start(Experimental) ctest_start(Experimental)
ctest_configure(OPTIONS "@CMAKE_TEST_GENERATOR_TOOLSET_SELECTION@-DCMAKE_MAKE_PROGRAM:FILEPATH=@CMAKE_TEST_MAKEPROGRAM@") ctest_configure(OPTIONS "@ctest_configure_options@")
ctest_build(TARGET test) ctest_build(TARGET test)

View File

@ -42,7 +42,6 @@ add_custom_command(
--build-target install --build-target install
--build-generator ${CMAKE_GENERATOR} --build-generator ${CMAKE_GENERATOR}
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake
VERBATIM VERBATIM
) )
@ -64,7 +63,6 @@ add_custom_command(
--build-project Import --build-project Import
--build-generator ${CMAKE_GENERATOR} --build-generator ${CMAKE_GENERATOR}
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake
VERBATIM VERBATIM
) )

View File

@ -1,3 +1,4 @@
set(CMAKE_MAKE_PROGRAM "@CMAKE_TEST_MAKEPROGRAM@" CACHE FILEPATH "Make Program")
set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler") set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler")
set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags") set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags")
set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags") set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags")

View File

@ -198,13 +198,13 @@ if(TEST_MODULE_DEPENDS)
--build-project ExtFort --build-project ExtFort
--build-generator ${CMAKE_GENERATOR} --build-generator ${CMAKE_GENERATOR}
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER} --build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER}
-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS} -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}
-DCMAKE_Fortran_FLAGS_DEBUG:STRING=${CMAKE_Fortran_FLAGS_DEBUG} -DCMAKE_Fortran_FLAGS_DEBUG:STRING=${CMAKE_Fortran_FLAGS_DEBUG}
-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE} -DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}
-DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL} -DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL}
-DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO}
-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}
${External_BUILD_TYPE} ${External_BUILD_TYPE}
VERBATIM VERBATIM
) )

View File

@ -38,7 +38,6 @@ add_custom_command(
--build-target install --build-target install
--build-generator ${CMAKE_GENERATOR} --build-generator ${CMAKE_GENERATOR}
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options -C${MacRuntimePath_BINARY_DIR}/InitialCache.cmake --build-options -C${MacRuntimePath_BINARY_DIR}/InitialCache.cmake
VERBATIM VERBATIM
) )
@ -60,7 +59,6 @@ add_custom_command(
--build-project MacRuntimePath_B --build-project MacRuntimePath_B
--build-generator ${CMAKE_GENERATOR} --build-generator ${CMAKE_GENERATOR}
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options -C${MacRuntimePath_BINARY_DIR}/InitialCache.cmake --build-options -C${MacRuntimePath_BINARY_DIR}/InitialCache.cmake
VERBATIM VERBATIM
) )

View File

@ -1,3 +1,4 @@
set(CMAKE_MAKE_PROGRAM "@CMAKE_TEST_MAKEPROGRAM@" CACHE FILEPATH "Make Program")
set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler") set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler")
set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags") set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags")
set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags") set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags")

View File

@ -44,14 +44,7 @@ add_executable(check_clean ${MakeClean_BINARY_DIR}/check_clean.c)
add_custom_command( add_custom_command(
TARGET check_clean TARGET check_clean
POST_BUILD POST_BUILD
COMMAND ${CMAKE_CTEST_COMMAND} COMMAND ${CMAKE_COMMAND} --build ${MakeClean_BINARY_DIR}/ToClean
ARGS --build-and-test --target clean
${MakeClean_SOURCE_DIR}/ToClean
${MakeClean_BINARY_DIR}/ToClean
--build-generator ${CMAKE_GENERATOR}
--build-project ToClean
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-noclean
--build-target clean
COMMENT "Clean the ToClean Project" COMMENT "Clean the ToClean Project"
) )

View File

@ -1,6 +1,6 @@
CMake Error at .*/Modules/CTest.cmake:[0-9]+ \(build_command\): CMake Error at .*/Modules/CTestTargets.cmake:20 \(message\):
build_command\(\) requires CMAKE_MAKE_PROGRAM to be defined. Call project\(\) Do not include\(CTest\) before calling project\(\).
or enable_language\(\) first.
Call Stack \(most recent call first\): Call Stack \(most recent call first\):
BeforeProject.cmake:[0-9]+ \(include\) .*/Modules/CTest.cmake:297 \(include\)
CMakeLists.txt:[0-9]+ \(include\) BeforeProject.cmake:1 \(include\)
CMakeLists.txt:5 \(include\)

View File

@ -1,5 +1,7 @@
CMake Error at BeforeProject.cmake:[0-9]+ \(build_command\): CMake Warning \(dev\) at BeforeProject.cmake:2 \(message\):
build_command\(\) requires CMAKE_MAKE_PROGRAM to be defined. Call project\(\) build_command\(\) returned:
or enable_language\(\) first.
.*cmake.* --build \..*
Call Stack \(most recent call first\): Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\) CMakeLists.txt:5 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.

View File

@ -1,2 +1,3 @@
build_command(MAKECOMMAND_DEFAULT_VALUE) build_command(MAKECOMMAND_DEFAULT_VALUE)
message(AUTHOR_WARNING "build_command() returned:\n ${MAKECOMMAND_DEFAULT_VALUE}")
project(${RunCMake_TEST} NONE) project(${RunCMake_TEST} NONE)

View File

@ -37,9 +37,9 @@ build_command(cmd)
message("4. cmd='${cmd}'") message("4. cmd='${cmd}'")
# Test the two-arg legacy signature: # Test the two-arg legacy signature:
build_command(legacy_cmd ${CMAKE_BUILD_TOOL}) build_command(legacy_cmd ${CMAKE_MAKE_PROGRAM})
message("5. legacy_cmd='${legacy_cmd}'") message("5. legacy_cmd='${legacy_cmd}'")
message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'") message(" CMAKE_MAKE_PROGRAM='${CMAKE_MAKE_PROGRAM}'")
# Test the optional KEYWORDs: # Test the optional KEYWORDs:
build_command(cmd CONFIGURATION hoohaaConfig) build_command(cmd CONFIGURATION hoohaaConfig)

View File

@ -308,7 +308,7 @@ else()
endif() endif()
if(CMAKE_CONFIGURATION_TYPES) if(CMAKE_CONFIGURATION_TYPES)
set(SI_CONFIG -C ${CMAKE_CFG_INTDIR}) set(SI_CONFIG --config $<CONFIGURATION>)
else() else()
set(SI_CONFIG) set(SI_CONFIG)
endif() endif()
@ -367,7 +367,9 @@ set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
if(CTEST_TEST_CPACK) if(CTEST_TEST_CPACK)
set(PACKAGE_TARGET --build-target package) set(package_command COMMAND
${CMAKE_COMMAND} --build . --target package ${SI_CONFIG}
)
# Avoid settings that require the .zip file command line tools... # Avoid settings that require the .zip file command line tools...
# (just build an NSIS installer without component support) # (just build an NSIS installer without component support)
@ -375,24 +377,19 @@ if(CTEST_TEST_CPACK)
set(CPACK_BINARY_ZIP OFF) set(CPACK_BINARY_ZIP OFF)
set(CPACK_MONOLITHIC_INSTALL ON) set(CPACK_MONOLITHIC_INSTALL ON)
else() else()
set(PACKAGE_TARGET) set(package_command)
endif() endif()
include(CPack) include(CPack)
set(install_command COMMAND
${CMAKE_COMMAND} --build . --target install ${SI_CONFIG}
)
add_custom_command( add_custom_command(
TARGET ${install_target} TARGET ${install_target}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_CTEST_COMMAND} ${install_command}
ARGS ${SI_CONFIG} ${package_command}
--build-and-test
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
--build-generator ${CMAKE_GENERATOR}
--build-project ${PROJECT_NAME}
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-noclean
--build-target install
${PACKAGE_TARGET}
COMMENT "Install Project" COMMENT "Install Project"
) )

View File

@ -308,7 +308,7 @@ else()
endif() endif()
if(CMAKE_CONFIGURATION_TYPES) if(CMAKE_CONFIGURATION_TYPES)
set(SI_CONFIG -C ${CMAKE_CFG_INTDIR}) set(SI_CONFIG --config $<CONFIGURATION>)
else() else()
set(SI_CONFIG) set(SI_CONFIG)
endif() endif()
@ -367,7 +367,9 @@ set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
if(CTEST_TEST_CPACK) if(CTEST_TEST_CPACK)
set(PACKAGE_TARGET --build-target package) set(package_command COMMAND
${CMAKE_COMMAND} --build . --target package ${SI_CONFIG}
)
# Avoid settings that require the .zip file command line tools... # Avoid settings that require the .zip file command line tools...
# (just build an NSIS installer without component support) # (just build an NSIS installer without component support)
@ -375,24 +377,19 @@ if(CTEST_TEST_CPACK)
set(CPACK_BINARY_ZIP OFF) set(CPACK_BINARY_ZIP OFF)
set(CPACK_MONOLITHIC_INSTALL ON) set(CPACK_MONOLITHIC_INSTALL ON)
else() else()
set(PACKAGE_TARGET) set(package_command)
endif() endif()
include(CPack) include(CPack)
set(install_command COMMAND
${CMAKE_COMMAND} --build . --target install ${SI_CONFIG}
)
add_custom_command( add_custom_command(
TARGET ${install_target} TARGET ${install_target}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_CTEST_COMMAND} ${install_command}
ARGS ${SI_CONFIG} ${package_command}
--build-and-test
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
--build-generator ${CMAKE_GENERATOR}
--build-project ${PROJECT_NAME}
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-noclean
--build-target install
${PACKAGE_TARGET}
COMMENT "Install Project" COMMENT "Install Project"
) )

View File

@ -1,63 +0,0 @@
#!/bin/sh
CMAKE_COMMAND="@CMAKE_INSTALL_PREFIX@/bin/cmake"
CMake_SOURCE_DIR="@CMake_SOURCE_DIR@"
CMake_BINARY_DIR="@CMake_BINARY_DIR@"
CMAKE_INSTALL_PREFIX="@CMAKE_INSTALL_PREFIX@"
CMAKE_BUILD_TOOL="@CMAKE_BUILD_TOOL@"
SOURCE_DIR="${CMake_SOURCE_DIR}/Tests/Simple"
BINARY_DIR="${CMake_BINARY_DIR}/Tests/TestInstall"
install()
{
echo "Erasing ${CMAKE_INSTALL_PREFIX}" &&
([ ! -d "${CMAKE_INSTALL_PREFIX}" ] || rm -rf "${CMAKE_INSTALL_PREFIX}") &&
mkdir -p "${CMAKE_INSTALL_PREFIX}" &&
echo "Running make install" &&
(
cd "${CMake_BINARY_DIR}" &&
"${CMAKE_BUILD_TOOL}" install
)
}
setup()
{
echo "Entering ${BINARY_DIR}" &&
cd "${BINARY_DIR}"
}
write_cache()
{
install || return 1
setup || return 1
echo "Writing CMakeCache.txt"
(
cat > CMakeCache.txt <<EOF
EOF
)
}
run_cmake()
{
write_cache || return 1
echo "Running CMake"
"${CMAKE_COMMAND}" "${SOURCE_DIR}"
}
run_make()
{
run_cmake || return 1
echo "Running ${CMAKE_BUILD_TOOL}"
"${CMAKE_BUILD_TOOL}"
}
run_test()
{
echo "Running ${BINARY_DIR}/simple"
(
"${BINARY_DIR}/simple"
)
}
run_make && run_test