Merge topic 'cleanup-build-commands'
e420124
CMakeDetermineCompilerId: Use CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND0c55729
VS: Add CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND variables
This commit is contained in:
commit
520ead7200
|
@ -68,7 +68,10 @@ Variables that Provide Information
|
||||||
/variable/CMAKE_TWEAK_VERSION
|
/variable/CMAKE_TWEAK_VERSION
|
||||||
/variable/CMAKE_VERBOSE_MAKEFILE
|
/variable/CMAKE_VERBOSE_MAKEFILE
|
||||||
/variable/CMAKE_VERSION
|
/variable/CMAKE_VERSION
|
||||||
|
/variable/CMAKE_VS_DEVENV_COMMAND
|
||||||
/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION
|
/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION
|
||||||
|
/variable/CMAKE_VS_MSBUILD_COMMAND
|
||||||
|
/variable/CMAKE_VS_MSDEV_COMMAND
|
||||||
/variable/CMAKE_VS_PLATFORM_TOOLSET
|
/variable/CMAKE_VS_PLATFORM_TOOLSET
|
||||||
/variable/CMAKE_XCODE_PLATFORM_TOOLSET
|
/variable/CMAKE_XCODE_PLATFORM_TOOLSET
|
||||||
/variable/PROJECT_BINARY_DIR
|
/variable/PROJECT_BINARY_DIR
|
||||||
|
|
|
@ -29,6 +29,10 @@ to configure the project:
|
||||||
* The Visual Studio generators set this to the full path to
|
* The Visual Studio generators set this to the full path to
|
||||||
``MSBuild.exe`` (VS >= 10), ``devenv.com`` (VS 7,8,9),
|
``MSBuild.exe`` (VS >= 10), ``devenv.com`` (VS 7,8,9),
|
||||||
``VCExpress.exe`` (VS Express 8,9), or ``msdev.exe`` (VS 6).
|
``VCExpress.exe`` (VS Express 8,9), or ``msdev.exe`` (VS 6).
|
||||||
|
(See also variables
|
||||||
|
:variable:`CMAKE_VS_MSBUILD_COMMAND`,
|
||||||
|
:variable:`CMAKE_VS_DEVENV_COMMAND`, and
|
||||||
|
:variable:`CMAKE_VS_MSDEV_COMMAND`.)
|
||||||
|
|
||||||
These generators prefer to lookup the build tool at build time
|
These generators prefer to lookup the build tool at build time
|
||||||
rather than to store ``CMAKE_MAKE_PROGRAM`` in the CMake cache
|
rather than to store ``CMAKE_MAKE_PROGRAM`` in the CMake cache
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
CMAKE_VS_DEVENV_COMMAND
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
The generators for :generator:`Visual Studio 7` and above set this
|
||||||
|
variable to the ``devenv.com`` command installed with the corresponding
|
||||||
|
Visual Studio version. Note that this variable may be empty on
|
||||||
|
Visual Studio Express editions because they do not provide this tool.
|
||||||
|
|
||||||
|
This variable is not defined by other generators even if ``devenv.com``
|
||||||
|
is installed on the computer.
|
||||||
|
|
||||||
|
The :variable:`CMAKE_VS_MSBUILD_COMMAND` is also provided for
|
||||||
|
:generator:`Visual Studio 10 2010` and above.
|
||||||
|
See also the :variable:`CMAKE_MAKE_PROGRAM` variable.
|
|
@ -0,0 +1,13 @@
|
||||||
|
CMAKE_VS_MSBUILD_COMMAND
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
The generators for :generator:`Visual Studio 10 2010` and above set this
|
||||||
|
variable to the ``MSBuild.exe`` command installed with the corresponding
|
||||||
|
Visual Studio version.
|
||||||
|
|
||||||
|
This variable is not defined by other generators even if ``MSBuild.exe``
|
||||||
|
is installed on the computer.
|
||||||
|
|
||||||
|
The :variable:`CMAKE_VS_DEVENV_COMMAND` is also provided for the
|
||||||
|
non-Express editions of Visual Studio.
|
||||||
|
See also the :variable:`CMAKE_MAKE_PROGRAM` variable.
|
|
@ -0,0 +1,10 @@
|
||||||
|
CMAKE_VS_MSDEV_COMMAND
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
The :generator:`Visual Studio 6` generator sets this variable to the
|
||||||
|
``msdev.exe`` command installed with Visual Studio 6.
|
||||||
|
|
||||||
|
This variable is not defined by other generators even if ``msdev.exe``
|
||||||
|
is installed on the computer.
|
||||||
|
|
||||||
|
See also the :variable:`CMAKE_MAKE_PROGRAM` variable.
|
|
@ -154,24 +154,33 @@ Id flags: ${testflags}
|
||||||
else()
|
else()
|
||||||
set(id_subsystem 1)
|
set(id_subsystem 1)
|
||||||
endif()
|
endif()
|
||||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
|
|
||||||
set(build /p:Configuration=Debug /p:Platform=@id_platform@ /p:VisualStudioVersion=${vs_version}.0)
|
|
||||||
elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]")
|
|
||||||
set(build /make)
|
|
||||||
else()
|
|
||||||
set(build /build Debug)
|
|
||||||
endif()
|
|
||||||
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
|
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||||
get_filename_component(id_src "${src}" NAME)
|
get_filename_component(id_src "${src}" NAME)
|
||||||
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
|
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
|
||||||
${id_dir}/CompilerId${lang}.${ext} @ONLY)
|
${id_dir}/CompilerId${lang}.${ext} @ONLY)
|
||||||
execute_process(
|
if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran")
|
||||||
COMMAND ${CMAKE_MAKE_PROGRAM} CompilerId${lang}.${ext} ${build}
|
set(command "${CMAKE_VS_MSBUILD_COMMAND}" "CompilerId${lang}.${ext}"
|
||||||
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
|
"/p:Configuration=Debug" "/p:Platform=${id_platform}" "/p:VisualStudioVersion=${vs_version}.0"
|
||||||
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
)
|
||||||
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
elseif(CMAKE_VS_DEVENV_COMMAND)
|
||||||
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
|
set(command "${CMAKE_VS_DEVENV_COMMAND}" "CompilerId${lang}.${ext}" "/build" "Debug")
|
||||||
)
|
elseif(CMAKE_VS_MSDEV_COMMAND)
|
||||||
|
set(command "${CMAKE_VS_MSDEV_COMMAND}" "CompilerId${lang}.${ext}" "/make")
|
||||||
|
else()
|
||||||
|
set(command "")
|
||||||
|
endif()
|
||||||
|
if(command)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${command}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||||
|
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||||
|
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||||
|
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(CMAKE_${lang}_COMPILER_ID_RESULT 1)
|
||||||
|
set(CMAKE_${lang}_COMPILER_ID_OUTPUT "VS environment not known to support ${lang}")
|
||||||
|
endif()
|
||||||
# Match the compiler location line printed out.
|
# Match the compiler location line printed out.
|
||||||
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]")
|
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]")
|
||||||
# Strip VS diagnostic output from the end of the line.
|
# Strip VS diagnostic output from the end of the line.
|
||||||
|
|
|
@ -255,6 +255,14 @@ std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase()
|
||||||
return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros";
|
return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
|
||||||
|
{
|
||||||
|
this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf);
|
||||||
|
mf->AddDefinition("CMAKE_VS_MSBUILD_COMMAND",
|
||||||
|
this->GetMSBuildCommand().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand()
|
std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand()
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,6 +91,8 @@ public:
|
||||||
|
|
||||||
virtual const char* GetToolsVersion() { return "4.0"; }
|
virtual const char* GetToolsVersion() { return "4.0"; }
|
||||||
|
|
||||||
|
virtual void FindMakeProgram(cmMakefile*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char* GetIDEVersion() { return "10.0"; }
|
virtual const char* GetIDEVersion() { return "10.0"; }
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,14 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGlobalVisualStudio6Generator::FindMakeProgram(cmMakefile* mf)
|
||||||
|
{
|
||||||
|
this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf);
|
||||||
|
mf->AddDefinition("CMAKE_VS_MSDEV_COMMAND",
|
||||||
|
this->GetMSDevCommand().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string const& cmGlobalVisualStudio6Generator::GetMSDevCommand()
|
std::string const& cmGlobalVisualStudio6Generator::GetMSDevCommand()
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,6 +89,8 @@ public:
|
||||||
///! What is the configurations directory variable called?
|
///! What is the configurations directory variable called?
|
||||||
virtual const char* GetCMakeCFGIntDir() const { return "$(IntDir)"; }
|
virtual const char* GetCMakeCFGIntDir() const { return "$(IntDir)"; }
|
||||||
|
|
||||||
|
virtual void FindMakeProgram(cmMakefile*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char* GetIDEVersion() { return "6.0"; }
|
virtual const char* GetIDEVersion() { return "6.0"; }
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -110,6 +110,14 @@ void cmGlobalVisualStudio7Generator
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGlobalVisualStudio7Generator::FindMakeProgram(cmMakefile* mf)
|
||||||
|
{
|
||||||
|
this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf);
|
||||||
|
mf->AddDefinition("CMAKE_VS_DEVENV_COMMAND",
|
||||||
|
this->GetDevEnvCommand().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand()
|
std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand()
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,6 +107,8 @@ public:
|
||||||
|
|
||||||
const char* GetIntelProjectVersion();
|
const char* GetIntelProjectVersion();
|
||||||
|
|
||||||
|
virtual void FindMakeProgram(cmMakefile*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char* GetIDEVersion() { return "7.0"; }
|
virtual const char* GetIDEVersion() { return "7.0"; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue