mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
Merge topic 'test-extra-generators'
ab6e1e49c0Tests: Simplify addition of extra generator tests882483192dcmake: Simplify internal conditions for adding extra generators Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4909
This commit is contained in:
@@ -64,10 +64,6 @@
|
||||
# include "cmVariableWatch.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
# define CMAKE_USE_ECLIPSE
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__) && defined(CMAKE_BOOTSTRAP)
|
||||
# define CMAKE_BOOT_MINGW
|
||||
#endif
|
||||
@@ -101,16 +97,13 @@
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
# include "cmGlobalNinjaGenerator.h"
|
||||
#endif
|
||||
#include "cmExtraCodeLiteGenerator.h"
|
||||
|
||||
#if !defined(CMAKE_BOOT_MINGW)
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
# include "cmExtraCodeBlocksGenerator.h"
|
||||
#endif
|
||||
#include "cmExtraKateGenerator.h"
|
||||
#include "cmExtraSublimeTextGenerator.h"
|
||||
|
||||
#ifdef CMAKE_USE_ECLIPSE
|
||||
# include "cmExtraCodeLiteGenerator.h"
|
||||
# include "cmExtraEclipseCDT4Generator.h"
|
||||
# include "cmExtraKateGenerator.h"
|
||||
# include "cmExtraSublimeTextGenerator.h"
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(_WIN32)
|
||||
@@ -1137,13 +1130,9 @@ void cmake::AddDefaultExtraGenerators()
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
this->ExtraGenerators.push_back(cmExtraCodeBlocksGenerator::GetFactory());
|
||||
this->ExtraGenerators.push_back(cmExtraCodeLiteGenerator::GetFactory());
|
||||
this->ExtraGenerators.push_back(cmExtraSublimeTextGenerator::GetFactory());
|
||||
this->ExtraGenerators.push_back(cmExtraKateGenerator::GetFactory());
|
||||
|
||||
# ifdef CMAKE_USE_ECLIPSE
|
||||
this->ExtraGenerators.push_back(cmExtraEclipseCDT4Generator::GetFactory());
|
||||
# endif
|
||||
|
||||
this->ExtraGenerators.push_back(cmExtraKateGenerator::GetFactory());
|
||||
this->ExtraGenerators.push_back(cmExtraSublimeTextGenerator::GetFactory());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -698,38 +698,28 @@ if(BUILD_TESTING)
|
||||
# build the "Simple" test with the ExtraGenerators, if available
|
||||
# This doesn't test whether the generated project files work (unfortunately),
|
||||
# mainly it tests that cmake doesn't crash when generating these project files.
|
||||
if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_GENERATOR} MATCHES "Ninja")
|
||||
|
||||
# check which generators we have
|
||||
execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help
|
||||
OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput)
|
||||
|
||||
set(extraGenerators
|
||||
"CodeBlocks"
|
||||
"CodeLite"
|
||||
"Eclipse CDT4"
|
||||
"Kate"
|
||||
"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
|
||||
"${CMake_SOURCE_DIR}/Tests/Simple"
|
||||
"${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}"
|
||||
--build-two-config
|
||||
--build-generator "${extraGenerator} - ${CMAKE_GENERATOR}"
|
||||
--build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
|
||||
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
|
||||
--build-project Simple
|
||||
--test-command Simple)
|
||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}")
|
||||
endif ()
|
||||
endforeach(extraGenerator)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "^(Unix Makefiles|Ninja)$"
|
||||
AND NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
foreach(extraGenerator
|
||||
"CodeBlocks"
|
||||
"CodeLite"
|
||||
"Eclipse CDT4"
|
||||
"Kate"
|
||||
"Sublime Text 2"
|
||||
)
|
||||
string(REPLACE " " "" extraGeneratorTestName "Simple_${extraGenerator}Generator")
|
||||
add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test
|
||||
"${CMake_SOURCE_DIR}/Tests/Simple"
|
||||
"${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}"
|
||||
--build-two-config
|
||||
--build-generator "${extraGenerator} - ${CMAKE_GENERATOR}"
|
||||
--build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
|
||||
--build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
|
||||
--build-project Simple
|
||||
--test-command Simple)
|
||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# test for correct sub-project generation
|
||||
|
||||
Reference in New Issue
Block a user