Tests: Simplify VSProjectInSubdir configuration

The test is only enabled on VS 10 and above, where the generators now
select for "ctest --build-and-test" the MSBuild tool by default.
Simplify the test configuration by dropping the --build-makeprogram
option and all the logic needed to compute its value.  The test will
automatically use MSBuild.
This commit is contained in:
Brad King 2013-11-14 14:21:40 -05:00
parent e965cb12e2
commit e47d934a5a
1 changed files with 11 additions and 25 deletions

View File

@ -1645,19 +1645,7 @@ ${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}")
else()
if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio (12)")
set(_msbuild_hints "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\${CMAKE_MATCH_1}.0;MSBuildToolsPath]")
else()
set(_FDIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkDir32]")
set(_FVER "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkVer32]")
set(_msbuild_hints ${_FDIR}/${_FVER})
endif()
find_program(MSBUILD_EXECUTABLE NAMES msbuild HINTS ${_msbuild_hints})
endif()
if(MSBUILD_EXECUTABLE)
add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND} add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir" "${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir"
@ -1665,13 +1653,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config --build-two-config
--build-generator ${CMAKE_TEST_GENERATOR} --build-generator ${CMAKE_TEST_GENERATOR}
--build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
--build-makeprogram "${MSBUILD_EXECUTABLE}"
--build-project VSProjectInSubdir --build-project VSProjectInSubdir
--build-target test) --build-target test)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir")
endif() endif()
endif() endif()
endif()
if (APPLE) if (APPLE)
if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")