Merge topic 'test-extra-generator-dedup'

9bd0643a Tests: Refactor testing of extra generators.
This commit is contained in:
Brad King 2016-08-24 09:45:36 -04:00 committed by CMake Topic Stage
commit 1d858dc017
1 changed files with 30 additions and 47 deletions

View File

@ -569,60 +569,43 @@ if(BUILD_TESTING)
ADD_LINK_FLAGS_TEST(mod_flags_config dll_flags_config) ADD_LINK_FLAGS_TEST(mod_flags_config dll_flags_config)
ADD_LINK_FLAGS_TEST(exe_flags_config mod_flags_config) ADD_LINK_FLAGS_TEST(exe_flags_config mod_flags_config)
# If we are running right now with a UnixMakefiles based generator, # If we are running right now with a Unix Makefiles or Ninja based generator,
# build the "Simple" test with the ExtraGenerators, if available # build the "Simple" test with the ExtraGenerators, if available
# This doesn't test whether the generated project files work (unfortunately), # This doesn't test whether the generated project files work (unfortunately),
# mainly it tests that cmake doesn't crash when generating these project files. # mainly it tests that cmake doesn't crash when generating these project files.
if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_GENERATOR} MATCHES "KDevelop") if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_GENERATOR} MATCHES "Ninja")
# check which generators we have # check which generators we have
execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help
OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput) OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput)
# check for the Eclipse generator
if ("${cmakeOutput}" MATCHES Eclipse)
add_test(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Simple"
"${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator"
--build-two-config
--build-generator "Eclipse CDT4 - Unix Makefiles"
--build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-project Simple
--build-options ${build_options}
--test-command Simple)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator")
endif ()
# check for the CodeBlocks generator set(extraGenerators
if ("${cmakeOutput}" MATCHES CodeBlocks) "CodeBlocks"
add_test(Simple_CodeBlocksGenerator ${CMAKE_CTEST_COMMAND} "CodeLite"
--build-and-test "Eclipse CDT4"
"${CMake_SOURCE_DIR}/Tests/Simple" "Kate"
"${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator" "KDevelop3"
--build-two-config "Sublime Text 2")
--build-generator "CodeBlocks - Unix Makefiles"
--build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" foreach(extraGenerator ${extraGenerators})
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" if ("${cmakeOutput}" MATCHES "${extraGenerator} - ${CMAKE_GENERATOR}")
--build-project Simple set(extraGeneratorTestName "Simple_${extraGenerator}Generator")
--build-options ${build_options} string(REPLACE " " "" extraGeneratorTestName ${extraGeneratorTestName})
--test-command Simple)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator") add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND}
endif () --build-and-test
# check for the KDevelop3 generator "${CMake_SOURCE_DIR}/Tests/Simple"
if ("${cmakeOutput}" MATCHES KDevelop3) "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}"
add_test(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND} --build-two-config
--build-and-test --build-generator "${extraGenerator} - ${CMAKE_GENERATOR}"
"${CMake_SOURCE_DIR}/Tests/Simple" --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
"${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator" --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-two-config --build-project Simple
--build-generator "KDevelop3 - Unix Makefiles" --build-options ${build_options}
--build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" --test-command Simple)
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}")
--build-project Simple endif ()
--build-options ${build_options} endforeach(extraGenerator)
--test-command Simple)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator")
endif ()
endif() endif()