mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-05 14:49:39 -06:00
Merge topic 'dev/test-for-bug-11230'
96a335fXCode generation should fail if lang isn't knownd3a8943Fix which string is checked for in the test220c5dcAdd test that CMake errors with empty libs
This commit is contained in:
@@ -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->
|
||||
|
||||
@@ -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")
|
||||
|
||||
4
Tests/EmptyLibrary/CMakeLists.txt
Normal file
4
Tests/EmptyLibrary/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(TestEmptyLibrary)
|
||||
|
||||
add_subdirectory(subdir)
|
||||
1
Tests/EmptyLibrary/subdir/CMakeLists.txt
Normal file
1
Tests/EmptyLibrary/subdir/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
add_library(test test.h)
|
||||
1
Tests/EmptyLibrary/subdir/test.h
Normal file
1
Tests/EmptyLibrary/subdir/test.h
Normal file
@@ -0,0 +1 @@
|
||||
extern int dummy;
|
||||
Reference in New Issue
Block a user