3

I have a cross-platform build system using CMake, and I have OpenCV dependency for iOS.

Setting ${OpenCV_DIR} manually, my project compile and execute correctly if and only if I set manually every time I generate XCODE project variable Project > Build Settings > Framework Search Paths with ${OpenCV_DIR}.

How can I set this variable using CMake directly?

herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
vgonisanz
  • 11,831
  • 13
  • 78
  • 130
  • Not sure I get your question right: do you want to specify OpenCV_DIR when runnin CMake? In which ase run cmake with `-DOpenCV_DIR=/path/to/opencv`. Or do you want that CMake sets up the environment variable OpenCV_DIR? in which case [check this answer](http://stackoverflow.com/a/21202129/1652461) – remi Oct 22 '14 at 13:40
  • XCode use a serie of variables in the projects. But it seems like lot of them are not filled by CMake. CMake set some info maps that mekae excode copile using info un build folder, but frarmework search path never is detected to me. I want to fill that path, or find the way to be found when XCode compiles. – vgonisanz Oct 23 '14 at 06:23
  • Have you read this documentation http://docs.opencv.org/doc/tutorials/introduction/ios_install/ios_install.html#ios-installation ? – Sergei Nikulov Oct 23 '14 at 06:35
  • I'm not building OpenCV. I'm using OpenCV in a cross-platform project. It works perfectly for Windows, Linux and Android, but I cannot link automatically prebuilt framework in iOS/MAC – vgonisanz Oct 23 '14 at 07:14
  • iOS/MAC is very similar to linux isn't it? Cant you just modify OpenCV CMakeLists to export the environment variable that you need as in the link in my first comment? – remi Oct 23 '14 at 08:07
  • Ios/MAC & Linux are based in UNIX, thats all. I need to edit, if is possible, XCode variables. If not, I need a way to compile using OpenCV_DIR with framework, but without edit enviroment variables. I always use local variables, if need edit manually, but inside CMake project. – vgonisanz Oct 23 '14 at 08:26

1 Answers1

2

CMake has no full integration with XCode. You can generate a project using it but a lot of things fails. Just drag into your project OpenCV and it will be detected.

Arun Bertil
  • 4,598
  • 4
  • 33
  • 59
  • Just to clarify, to make the magic: 1º Drag the framework, 2º add the path containing the framework to Search framework path in the Build settings of the target and it will work – vgonisanz Jun 23 '15 at 14:36