summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/cmMakefile.cxx21
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/project/ExplicitRC.cmake1
-rw-r--r--Tests/RunCMake/project/RunCMakeTest.cmake3
4 files changed, 25 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 48e6c61826..df993ceb7e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3142,7 +3142,26 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const& lang,
{
this->AddDefinition("CMAKE_CFG_INTDIR",
this->GetGlobalGenerator()->GetCMakeCFGIntDir());
- this->GetGlobalGenerator()->EnableLanguage(lang, this, optional);
+ // If RC is explicitly listed we need to do it after other languages.
+ // On some platforms we enable RC implicitly while enabling others.
+ // Do not let that look like recursive enable_language(RC).
+ std::vector<std::string> langs;
+ std::vector<std::string> langsRC;
+ langs.reserve(lang.size());
+ for (std::vector<std::string>::const_iterator i = lang.begin();
+ i != lang.end(); ++i) {
+ if (i->compare("RC") == 0) {
+ langsRC.push_back(*i);
+ } else {
+ langs.push_back(*i);
+ }
+ }
+ if (!langs.empty()) {
+ this->GetGlobalGenerator()->EnableLanguage(langs, this, optional);
+ }
+ if (!langsRC.empty()) {
+ this->GetGlobalGenerator()->EnableLanguage(langsRC, this, optional);
+ }
}
int cmMakefile::TryCompile(const std::string& srcdir,
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 778982fafa..0eafbeff56 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -207,7 +207,7 @@ add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(list)
add_RunCMake_test(message)
-add_RunCMake_test(project)
+add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
add_RunCMake_test(return)
add_RunCMake_test(set_property)
add_RunCMake_test(string)
diff --git a/Tests/RunCMake/project/ExplicitRC.cmake b/Tests/RunCMake/project/ExplicitRC.cmake
new file mode 100644
index 0000000000..b3feaa9b86
--- /dev/null
+++ b/Tests/RunCMake/project/ExplicitRC.cmake
@@ -0,0 +1 @@
+project(ExplicitRC C RC)
diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake
index 6ab0fc9571..dba97d2b2f 100644
--- a/Tests/RunCMake/project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/project/RunCMakeTest.cmake
@@ -1,5 +1,8 @@
include(RunCMake)
+if(CMake_TEST_RESOURCES)
+ run_cmake(ExplicitRC)
+endif()
run_cmake(LanguagesImplicit)
run_cmake(LanguagesEmpty)
run_cmake(LanguagesNONE)