diff options
author | Brad King <brad.king@kitware.com> | 2010-10-05 19:30:10 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2010-10-05 19:30:10 (GMT) |
commit | b653e8b6e7d9edb857b6eafd2e5b82902903e998 (patch) | |
tree | e1b1236cc626bdd62b692448a1bde854a62426df | |
parent | 54a3bf001c2a6ed4ddda28e779f7515fbd4c2edf (diff) | |
parent | 96a335fd8d43b1fd73de12d29c192a29eaf5231a (diff) | |
download | CMake-b653e8b6e7d9edb857b6eafd2e5b82902903e998.zip CMake-b653e8b6e7d9edb857b6eafd2e5b82902903e998.tar.gz CMake-b653e8b6e7d9edb857b6eafd2e5b82902903e998.tar.bz2 |
Merge topic 'dev/test-for-bug-11230'
96a335f XCode generation should fail if lang isn't known
d3a8943 Fix which string is checked for in the test
220c5dc Add test that CMake errors with empty libs
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 10 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/EmptyLibrary/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/EmptyLibrary/subdir/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/EmptyLibrary/subdir/test.h | 1 |
5 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f989a5c..0976a4d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1424,6 +1424,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, std::string defFlags; bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) || (target.GetType() == cmTarget::MODULE_LIBRARY)); + bool binary = ((target.GetType() == cmTarget::STATIC_LIBRARY) || + (target.GetType() == cmTarget::EXECUTABLE) || + shared); const char* lang = target.GetLinkerLanguage(configName); std::string cflags; @@ -1442,6 +1445,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // Add shared-library flags if needed. this->CurrentLocalGenerator->AddSharedFlags(flags, lang, shared); } + else if(binary) + { + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); + return; + } // Add define flags this->CurrentLocalGenerator-> diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5e88b5c..c056e86 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -153,6 +153,9 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) + ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) + SET_TESTS_PROPERTIES(EmptyLibrary PROPERTIES + PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test") ADD_TEST_MACRO(CrossCompile CrossCompile) SET_TESTS_PROPERTIES(CrossCompile PROPERTIES PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode") diff --git a/Tests/EmptyLibrary/CMakeLists.txt b/Tests/EmptyLibrary/CMakeLists.txt new file mode 100644 index 0000000..baddbbf --- /dev/null +++ b/Tests/EmptyLibrary/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.6) +project(TestEmptyLibrary) + +add_subdirectory(subdir) diff --git a/Tests/EmptyLibrary/subdir/CMakeLists.txt b/Tests/EmptyLibrary/subdir/CMakeLists.txt new file mode 100644 index 0000000..e273f8d --- /dev/null +++ b/Tests/EmptyLibrary/subdir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(test test.h) diff --git a/Tests/EmptyLibrary/subdir/test.h b/Tests/EmptyLibrary/subdir/test.h new file mode 100644 index 0000000..8511f53 --- /dev/null +++ b/Tests/EmptyLibrary/subdir/test.h @@ -0,0 +1 @@ +extern int dummy; |