Merge topic '16101-xcode-fix-directory-exclude-from-all'
df32e564
Xcode: Add targets marked as EXCLUDE_FROM_ALL to project (#16101)
This commit is contained in:
commit
0a2d0b126c
|
@ -2635,13 +2635,10 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
|
|||
}
|
||||
|
||||
bool cmGlobalXCodeGenerator::CreateGroups(
|
||||
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators)
|
||||
std::vector<cmLocalGenerator*>& generators)
|
||||
{
|
||||
for (std::vector<cmLocalGenerator*>::iterator i = generators.begin();
|
||||
i != generators.end(); ++i) {
|
||||
if (this->IsExcluded(root, *i)) {
|
||||
continue;
|
||||
}
|
||||
cmMakefile* mf = (*i)->GetMakefile();
|
||||
std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
|
||||
std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
|
||||
|
@ -2873,7 +2870,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
|||
this->MainGroupChildren->AddObject(resourcesGroup);
|
||||
|
||||
// now create the cmake groups
|
||||
if (!this->CreateGroups(root, generators)) {
|
||||
if (!this->CreateGroups(generators)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3041,10 +3038,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
|||
std::vector<cmXCodeObject*> targets;
|
||||
for (std::vector<cmLocalGenerator*>::iterator i = generators.begin();
|
||||
i != generators.end(); ++i) {
|
||||
if (!this->IsExcluded(root, *i)) {
|
||||
if (!this->CreateXCodeTargets(*i, targets)) {
|
||||
return false;
|
||||
}
|
||||
if (!this->CreateXCodeTargets(*i, targets)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// loop over all targets and add link and depend info
|
||||
|
|
|
@ -92,8 +92,7 @@ private:
|
|||
cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt,
|
||||
cmSourceGroup* sg);
|
||||
cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent, std::string name);
|
||||
bool CreateGroups(cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>& generators);
|
||||
bool CreateGroups(std::vector<cmLocalGenerator*>& generators);
|
||||
std::string XCodeEscapePath(const std::string& p);
|
||||
std::string RelativeToSource(const char* p);
|
||||
std::string RelativeToBinary(const char* p);
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
enable_language(CXX)
|
||||
|
||||
add_subdirectory(ExcludeFromAll EXCLUDE_FROM_ALL)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main PRIVATE foo)
|
|
@ -0,0 +1,4 @@
|
|||
add_library(bar STATIC bar.cpp)
|
||||
|
||||
add_library(foo STATIC foo.cpp)
|
||||
target_include_directories(foo PUBLIC .)
|
|
@ -0,0 +1 @@
|
|||
#error This should be excluded from all target
|
|
@ -0,0 +1,6 @@
|
|||
#include "foo.h"
|
||||
|
||||
int foo()
|
||||
{
|
||||
return 42;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
int foo();
|
|
@ -3,3 +3,15 @@ include(RunCMake)
|
|||
run_cmake(DoesNotExist)
|
||||
run_cmake(Missing)
|
||||
run_cmake(Function)
|
||||
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExcludeFromAll-build)
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
|
||||
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
|
||||
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
||||
|
||||
run_cmake(ExcludeFromAll)
|
||||
run_cmake_command(ExcludeFromAll-build ${CMAKE_COMMAND} --build .)
|
||||
|
||||
unset(RunCMake_TEST_BINARY_DIR)
|
||||
unset(RunCMake_TEST_NO_CLEAN)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#include "foo.h"
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
return foo();
|
||||
}
|
Loading…
Reference in New Issue