Commit df32e564 authored by Gregor Jasny's avatar Gregor Jasny Committed by Brad King

Xcode: Add targets marked as EXCLUDE_FROM_ALL to project (#16101)

parent ff88df48
......@@ -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);
......
enable_language(CXX)
add_subdirectory(ExcludeFromAll EXCLUDE_FROM_ALL)
add_executable(main main.cpp)
target_link_libraries(main PRIVATE foo)
add_library(bar STATIC bar.cpp)
add_library(foo STATIC foo.cpp)
target_include_directories(foo PUBLIC .)
#error This should be excluded from all target
#include "foo.h"
int foo()
{
return 42;
}
......@@ -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)
#include "foo.h"
int main(int, char**)
{
return foo();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment