Tests: Refactor testing of extra generators.
Use a loop instead of repeating the same thing multiple times.
This commit is contained in:
parent
797f7ad87d
commit
9bd0643a77
|
@ -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"
|
||||||
|
"Eclipse CDT4"
|
||||||
|
"Kate"
|
||||||
|
"KDevelop3"
|
||||||
|
"Sublime Text 2")
|
||||||
|
|
||||||
|
foreach(extraGenerator ${extraGenerators})
|
||||||
|
if ("${cmakeOutput}" MATCHES "${extraGenerator} - ${CMAKE_GENERATOR}")
|
||||||
|
set(extraGeneratorTestName "Simple_${extraGenerator}Generator")
|
||||||
|
string(REPLACE " " "" extraGeneratorTestName ${extraGeneratorTestName})
|
||||||
|
|
||||||
|
add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND}
|
||||||
--build-and-test
|
--build-and-test
|
||||||
"${CMake_SOURCE_DIR}/Tests/Simple"
|
"${CMake_SOURCE_DIR}/Tests/Simple"
|
||||||
"${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator"
|
"${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}"
|
||||||
--build-two-config
|
--build-two-config
|
||||||
--build-generator "CodeBlocks - Unix Makefiles"
|
--build-generator "${extraGenerator} - ${CMAKE_GENERATOR}"
|
||||||
--build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
|
--build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
|
||||||
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
|
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
|
||||||
--build-project Simple
|
--build-project Simple
|
||||||
--build-options ${build_options}
|
--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/${extraGeneratorTestName}")
|
||||||
endif ()
|
|
||||||
# check for the KDevelop3 generator
|
|
||||||
if ("${cmakeOutput}" MATCHES KDevelop3)
|
|
||||||
add_test(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND}
|
|
||||||
--build-and-test
|
|
||||||
"${CMake_SOURCE_DIR}/Tests/Simple"
|
|
||||||
"${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator"
|
|
||||||
--build-two-config
|
|
||||||
--build-generator "KDevelop3 - 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_KDevelop3Generator")
|
|
||||||
endif ()
|
endif ()
|
||||||
|
endforeach(extraGenerator)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue