Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake generated Xcode project fails to find the binary "Products" that are built from Xcode

I am trying to use CMake Generated Xcode project. Everything looks good when building, except that Xcode can not find the binaries that are built. Below is a screenshot i took after successfully build the product. I can see them in the project source directory. However, notice that the Xcode showing RED "HelloWorld", which means it can not find the products.

Screenshot of Products not available showing Red

Configurations: CMake 2.8.6 with Xcode 4.2 on Lion 10.7.2

This is CMakeLists.txt

project(HelloWorld)

add_executable(${PROJECT_NAME} HelloWorld.cpp)

This is the source code for HelloWorld.cpp

#include <iostream>

int main(){
    std::cout << "HelloWorld!" << std::endl;

    return 0;
}

I tried to create a raw project directly from Xcode, after compiles, the products shows black instead of red font, which means Xcode found the products. So i am sure this is related to CMake Generated Xcode project.

Anyone got any idea? how to fix this?

like image 581
Negative Zero Avatar asked Dec 11 '11 21:12

Negative Zero


1 Answers

The xcode project file (which I guess, in your case would be named something like HelloWorld.xcproject/project.pbxproject, will have SYMROOT definitions for each of the build configurations per target.
You can either change all the SYMROOT definitions to the same value or remove all of those (xcode will default to "build").
Project, if open, should autoreload. Select ALL_BUILD or HelloWord, clean and build.

Not sure if it is an issue with the way cmake adds the SYMROOT.
Note: I know this only hints at what the problem could be and not a solution but am not allowed to add comments yet :)

like image 133
Vishal Avatar answered Nov 14 '22 23:11

Vishal